public IHttpActionResult EditTask(dhtmlxganttTask task)
 {
     if (task == null)
     {
         return(BadRequest("task object must be sent in the request body"));
     }
     try
     {
         var dbTask = projectsService.GetTask(task.id);
         dbTask.Description      = task.text;
         dbTask.ForcastStartDate = task.start_date;
         dbTask.ForcastEndDate   = task.start_date.AddDays(task.duration);
         dbTask.IsMileStone      = task.type == "gantt.config.types.milestone" ? true : false;
         dbTask.Objectives       = task.text;
         dbTask.Output           = task.text;
         dbTask.PlanStartDate    = task.start_date;
         dbTask.PlanEndDate      = task.start_date.AddDays(task.duration);
         dbTask.IsActive         = true;
         dbTask.KPIs             = task.text;
         dbTask.TaskDuration     = task.duration;
         dbTask.TaskName         = task.text;
         //dbTask.TaskStatus = 1;
         //var dbTask = new ProjectTask()
         //{
         //    CompletionPercentage = 0,
         //    CreatedDate = DateTime.Now,
         //    Description = task.text,
         //    ForcastStartDate = task.start_date,
         //    ForcastEndDate = task.start_date.AddDays(task.duration),
         //    IsMileStone = task.type == "gantt.config.types.milestone" ? true : false,
         //    Objectives = task.text,
         //    Output = task.text,
         //    KPIs = task.text,
         //    ParentTaskId = task.parent == 0 ? null : task.parent as int?,
         //    PlanStartDate = task.start_date,
         //    PlanEndDate = task.start_date.AddDays(task.duration),
         //    ProjectId = task.projectId,
         //    IsActive = true,
         //    TaskComplete = false,
         //    TaskDuration = task.duration,
         //    TaskName = task.text,
         //    TaskStatus = 1,
         //    VersionDate = DateTime.Now
         //};
         projectsService.EditTask(dbTask);
         return(Ok());
     }
     catch (Exception ex)
     {
         return(InternalServerError(ex));
     }
 }