-
Notifications
You must be signed in to change notification settings - Fork 1
/
HomeController.cs
36 lines (30 loc) · 1.21 KB
/
HomeController.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
using System.Web.Mvc;
using DevExpress.Web.Mvc;
using Sample.Models;
namespace Sample.Controllers {
public class HomeController : Controller {
PersonsList list = new PersonsList();
public ActionResult Index() {
return View(list.GetPersons());
}
public ActionResult GridViewTemplatePartial() {
return PartialView(list.GetPersons());
}
[HttpPost, ValidateInput(false)]
public ActionResult EditingAddNew([ModelBinder(typeof(DevExpressEditorsBinder))] Person person) {
if (ModelState.IsValid)
list.AddPerson(person);
return PartialView("GridViewTemplatePartial", list.GetPersons());
}
[HttpPost, ValidateInput(false)]
public ActionResult EditingUpdate([ModelBinder(typeof(DevExpressEditorsBinder))] Person personInfo) {
if (ModelState.IsValid)
list.UpdatePerson(personInfo);
return PartialView("GridViewTemplatePartial", list.GetPersons());
}
public ActionResult EditingDelete(int personId) {
list.DeletePerson(personId);
return PartialView("GridViewTemplatePartial", list.GetPersons());
}
}
}