.NET
0
Вклад в тег
public class Book
{
public string Title {get;set;}
public string Author {get;set;}
}
public class BookController : Controller
{
[HttpPost]
public ActionResult Create(Book model, IEnumerable<HttpPostedFileBase> fileUpload)
{
throw new NotImplementedException();
}
}
@using (Html.BeginForm("Create", "Book", FormMethod.Post, new { enctype = "multipart/form-data" }))
{
@Html.EditorFor(m => m)
<input type="file" name="fileUpload[0]" /><br />
<input type="file" name="fileUpload[1]" /><br />
<input type="file" name="fileUpload[2]" /><br />
<input type="submit" name="Submit" id="SubmitMultiply" value="Upload" />
}
<input type="file" name="fileUpload[0]" />
IEnumerable<HttpPostedFileBase> fileUpload
//property selector
Func<Person, Boolean> propertySelector = person => person.FirstNameIsActive;
//your predicate
Func<Person, Boolean> predicate = person => propertySelector(person) == true;
//new person with true, false properties.
Person p = new Person() {FirstNameIsActive = true,SecondNameIsActive = false};
Console.WriteLine(predicate(p).ToString()); //prints true
//change the property selector
propertySelector = person => person.SecondNameIsActive;
//now the predicate uses the new property selector
Console.WriteLine(predicate(p).ToString()); //prints false