예제 #1
0
 public List <Core.Models.Task> Post([FromBody] Core.Models.Task task)
 {
     if (task.Id == null)
     {
         _service.Add(task);
     }
     else
     {
         _service.Edit(task);
     }
     return(_service.GetAll());
 }
예제 #2
0
 public ActionResult Edit(int id, IFormCollection collection)
 {
     try
     {
         var task = new Core.Models.Task
         {
             Description = collection["Name"].ToString(),
             Status      = collection["Status"] == "true"
         };
         _service.Edit(task);
         return(RedirectToAction(nameof(Index)));
     }
     catch
     {
         return(View());
     }
 }