-
Notifications
You must be signed in to change notification settings - Fork 2
/
HomeController.vb
47 lines (41 loc) · 1.36 KB
/
HomeController.vb
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
37
38
39
40
41
42
43
44
45
46
47
Imports Microsoft.VisualBasic
Imports DevExpress.Web.Mvc
Imports DXWebApplication1.Models
Imports System
Imports System.Collections.Generic
Imports System.Linq
Imports System.Web
Imports System.Web.Mvc
Namespace DXWebApplication1.Controllers
Public Class HomeController
Inherits Controller
' GET: Home
Public Function Index() As ActionResult
Return View(PersonsList.GetPersons())
End Function
Public Function GridViewPartial() As ActionResult
Return PartialView(PersonsList.GetPersons())
End Function
<HttpPost, ValidateInput(False)> _
Public Function BatchEditingUpdateModelPerson(ByVal batchValues As MVCxGridViewBatchUpdateValues(Of Person, Integer)) As ActionResult
For Each person In batchValues.Update
If batchValues.IsValid(person) Then
PersonsList.UpdatePerson(person)
Else
batchValues.SetErrorText(person, "Correct validation errors")
End If
Next person
For Each person In batchValues.Insert
If batchValues.IsValid(person) Then
PersonsList.AddPerson(person)
Else
batchValues.SetErrorText(person, "Correct validation errors")
End If
Next person
For Each personID In batchValues.DeleteKeys
PersonsList.DeletePerson(personID)
Next personID
Return PartialView("GridViewPartial", PersonsList.GetPersons())
End Function
End Class
End Namespace