public async Task <ActionResult> Delete([FromBody] RequestId request) { try { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } return(Ok(await _pTaskService.Delete(request.Id))); } catch (Exception ex) { return(BadRequest(new Response { IsSuccess = true, Message = ex.Message })); } }
public ActionResult DeleteTask(int?Id) { if (Id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } PTask task = ptaskService.Find(Id); if (task == null) { return(HttpNotFound()); } ptaskService.Delete(task.Id); ProjectViewModel projectVm = Mapper.Map <ProjectViewModel>(this.projectService.Find(ProjectId)); return(PartialView("_TasksList", projectVm.Tasks)); }