示例#1
0
 public JsonResult EditTask(string id, TaskViewModel task)
 {
     return(new JsonResult()
     {
         JsonRequestBehavior = JsonRequestBehavior.AllowGet,
         Data = new { result = _taskLogic.Edit(id, task) }
     });
     // return Json(_taskLogic.Edit(id, task), JsonRequestBehavior.AllowGet);
 }
        public ActionResult Edit(TaskViewModel editedTask)
        {
            if (editedTask == null)
            {
                return(RedirectToAction("Index")); //this should be done with a filter function in a real implementation and probably display some sort of an error or validation message
            }
            var response = _taskLogic.Edit(editedTask);

            // Validate the response here, return to the editing page if the backend validation failed and display a custom validation error
            //also if valid display message that edit was successfull
            return(RedirectToAction("Index"));
        }