public ActionResult AddTask(TaskViewModel model) { TaskModel data = new TaskModel(); Mapper.Map(model, data); data.jobId = model.jobId; data.departmentId = model.departmentId; data.userId = model.userId; if (model.TaskId == 0) { itaskBusiness.AddTask(data); return(Json(new { success = true, title = "<strong>Success:</strong>", type = "success", message = "Task added Succesfully", action = "added" })); } else if (model.TaskId != 0) { var datamodal = new TaskModel(); datamodal.TaskId = model.TaskId; datamodal.jobId = model.jobId; datamodal.departmentId = model.departmentId; datamodal.TaskName = model.TaskName; datamodal.BudgetedHours = model.BudgetedHours; datamodal.TargetCompletionDate = model.TargetCompletionDate; datamodal.Employee = model.Employee; datamodal.Status = model.Status; datamodal.userId = model.userId; itaskBusiness.UpdateTask(datamodal); return(Json(new { success = true, title = "<strong>Update:</strong>", type = "info", message = "Task updated Succesfully", action = "edit" })); } //else{ // //ModelState.AddModelError("", "Some Error."); //} // return PartialView("_AddTask", model); return(Json(new { success = true })); // return RedirectToAction("Index"); }
public async Task CreateTask([FromBody] UserTask task) { await _taskBusiness.AddTask(task); }
public bool AddTask(TaskModel Task) { return(p1.AddTask(Task)); }