Editor.NET UploadMany example error when using 'Where' method
Editor.NET UploadMany example error when using 'Where' method
I added 'Where' method to 'UploadManyController.cs, line44' that makes no data filtered.
And 'IndexOutOfRangeException' error occurs when executing debug.
Could you tell me how to fix this.
using (var db = new Database(settings.DbType, settings.DbConnection))
{
var response = new Editor(db, "users")
.Model<UploadManyModel>()
.Field(new Field("users.site")
.Options(new Options()
.Table("sites")
.Value("id")
.Label("name")
)
)
.LeftJoin("sites", "sites.id", "=", "users.site")
.Where("users.site", "0")
.MJoin(new MJoin("files")
.Link("users.id", "users_files.user_id")
.Link("files.id", "users_files.file_id")
.Field(
new Field("id")
.Upload(new Upload(request.PhysicalApplicationPath + @"uploads\__ID____EXTN__")
.Db("files", "id", new Dictionary<string, object>
{
{"web_path", Upload.DbType.WebPath},
{"system_path", Upload.DbType.SystemPath},
{"filename", Upload.DbType.FileName},
{"filesize", Upload.DbType.FileSize}
})
.Validator(Validation.FileSize(5000000, "Max file size is 5000K."))
.Validator(Validation.FileExtensions(new[] { "jpg", "png", "gif" }, "Please upload an image."))
)
)
)
.Process(request)
.Data();
return Json(response);
}
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
Hi,
Thanks for letting me know about this. I'm travelling at the moment, but I'll check this out when I get back (tomorrow) and let you know what I find.
Allan
Thank you very much, Allan.
In the
Mjoin.cs
file you will find a line:if (result.Count() != 0) {
in theData
method. That line should actually be:That will be in the next release of Editor which won't be too far away.
Regards,
Allan