예제 #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 Create(IFormCollection collection)
 {
     try
     {
         var task = new Core.Models.Task
         {
             Description = collection["Name"].ToString(),
             Status      = false
         };
         _service.Add(task);
         return(RedirectToAction(nameof(Index)));
     }
     catch (Exception ex)
     {
         return(View());
     }
 }