我正在尝试保存对函数列表(xxx)所做的更改...我是否因为它在UpdateModel(e)上的barf并且说:
System.InvalidOperationException was unhandled by user code
Message=The model of type 'xxxxxxx.attendance' could not be updated.
Source=System.Web.Mvc
StackTrace:
at System.Web.Mvc.Controller.UpdateModel[TModel](TModel model, String prefix, String[] includeProperties, String[] excludeProperties, IValueProvider valueProvider)
at System.Web.Mvc.Controller.UpdateModel[TModel](TModel model)
at xxxxxxx.xxxxxxxx.AdminController.ClassAttendance(List`1 attendance) in c:\users\bryan\documents\visual studio 2010\Projects\xxxx\xxxxxxx\Controllers\AdminController.vb:line 1207
at lambda_method(Closure , ControllerBase , Object[] )
at System.Web.Mvc.ActionMethodDispatcher.Execute(ControllerBase controller, Object[] parameters)
at System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary`2 parameters)
at System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary`2 parameters)
at System.Web.Mvc.ControllerActionInvoker.<>c__DisplayClass15.<InvokeActionMethodWithFilters>b__12()
at System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodFilter(IActionFilter filter, ActionExecutingContext preContext, Func`1 continuation)
InnerException:
我的功能如下:
<AcceptVerbs(HttpVerbs.Post)>
Function ClassAttendance(ByVal attendance As List(Of attendance)) As ActionResult
For Each attendee In attendance
Dim item = attendee
Dim e = db.attendances.Single(Function(t) t.id = item.id)
Dim _Class_Ref As String = item.course_ref
Dim _Comments As String = item.Comments
Dim _Course_Status As String = item.Completed_Class
If Not String.IsNullOrEmpty(_Comments) Then
e.Comments = _Comments
End If
e.Completed_Class = _Course_Status
UpdateModel(e)
db.SaveChanges()
Next
Return RedirectToAction("Index")
End Function
这个功能在???
出错了