public IActionResult Add(SubTaskDto request) { try { _subTaskService.AddSubTask(request); return(Ok("Success")); } catch (CustomException ex) { return(BadRequest(ex.Message)); } catch (Exception ex) { return(BadRequest(ex.Message)); } }
public ActionResult Post([FromBody] SubTaskDto request) { try { _subTaskService.AddSubTask(request); Debug.WriteLine($"Successfully added subtask: {request.Text}"); return(Ok($"Successfully added subtask: {request.Text}")); } catch (SubTaskException ex) { Debug.WriteLine($"SUBTASK: {ex.Message}"); return(BadRequest(ex.Message)); } catch (Exception ex) { Debug.WriteLine($"SUBTASK: {ex.Message}"); return(BadRequest(ex.Message)); } }
public IHttpActionResult PostSubTask([FromBody] SubTaskDTO subtask) { try { if (subtask == null) { return(BadRequest()); } SubTaskDTO result = subTaskService.AddSubTask(subtask); return(Created(Request.RequestUri + "/" + result.Id.ToString(), result)); } catch (ValidationException) { return(BadRequest()); } catch (Exception) { return(InternalServerError()); } }
public IActionResult AddSubTAsk(SubTaskViewModel model) { _subTaskServices.AddSubTask(model); return(RedirectToAction("GetById", "Task", new { id = model.TaskId })); }