예제 #1
0
 public IActionResult Complete(int id)
 {
     if (_todoService.Complete(id))
     {
         TempData["success"] = "Task completed!";
         return(RedirectToAction("Index"));
     }
     else
     {
         TempData["error"] = "Some error(s) accured while task complete";
         return(RedirectToAction("Index"));
     }
 }
예제 #2
0
        public async Task <IActionResult> Complete(int id)
        {
            // Guards
            var existingItem = await _todoService.GetByIdAsync(id);

            if (existingItem == null)
            {
                return(NotFound());
            }

            // Update logic
            _todoService.Complete(id);

            // Return update ok result
            return(NoContent());
        }
예제 #3
0
 public IActionResult Complete([FromRoute] int id)
 {
     _toDoService.Complete(id);
     return(Ok());
 }
예제 #4
0
 public JsonResult Complete(Guid id)
 {
     _todoService.Complete(id);
     return(Json(JsonEnvelope.Success()));
 }