/// <summary>
 /// Add New Task
 /// </summary>
 /// <param name="task">Task</param>
 /// <returns>Int</returns>
 public int AddTask(task.Task task)
 {
     using (ProjectManagementEntities projectMngtEntity = new ProjectManagementEntities())
     {
         try
         {
             projectMngtEntity.tblTasks.Add(TransfereTotblTask(new List <task.Task>()
             {
                 task
             }).FirstOrDefault());
             return(projectMngtEntity.SaveChanges());
         }
         catch (Exception ex)
         {
             throw ex;
         }
     }
 }
        /// <summary>
        /// Updated Task
        /// </summary>
        /// <param name="task">Project</param>
        /// <returns>int</returns>
        public int UpdateTask(task.Task task)
        {
            using (ProjectManagementEntities projectMngtEntity = new ProjectManagementEntities())
            {
                var existingTask = projectMngtEntity.tblTasks.Find(task.TaskID);
                if (existingTask != null)
                {
                    existingTask.ParentID  = task.ParentTaskId;
                    existingTask.ProjectID = task.ProjectId;
                    existingTask.Task      = task.TaskDesc;
                    existingTask.StartDt   = task.StartDate;
                    existingTask.EndDt     = task.EndDate;
                    existingTask.Priority  = task.Priority;
                    existingTask.Status    = task.Status;

                    return(projectMngtEntity.SaveChanges());
                }
                else
                {
                    return(-1);
                }
            }
        }
 /// <summary>
 /// Updated Task
 /// </summary>
 /// <param name="task">Task</param>
 /// <returns>int</returns>
 public int UpdateTask(ProjectManagement_Entity.Task task)
 {
     return(taskContext.UpdateTask(task));
 }
 /// <summary>
 /// Add New Task
 /// </summary>
 /// <param name="task">Task</param>
 /// <returns>int</returns>
 public int AddTask(ProjectManagement_Entity.Task task)
 {
     return(taskContext.AddTask(task));
 }