Beispiel #1
0
        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");
        }
Beispiel #2
0
 public async Task <bool> Put(UserTask task)
 {
     return(await _taskBusiness.UpdateTask(task));
 }
Beispiel #3
0
 public bool update([FromBody] TaskDTO value, int id)
 {
     return(_taskBusiness.UpdateTask(value, value.TaskId));
 }