Пример #1
0
        public int UpdateTask(TaskBL task)
        {
            int result = -1;
            var tTask  = _taskManager.tblTasks.Where(t => t.TaskID == task.TaskID).FirstOrDefault();

            if (tTask != null)
            {
                tTask.ParentTask = task.ParentTask;
                tTask.Priority   = task.Priority;
                tTask.StartDate  = task.StartDate;
                tTask.EndDate    = task.EndDate;
                result           = _taskManager.SaveChanges();
            }
            return(result);
        }
Пример #2
0
 public void UpdateTask(TaskBL task)
 {
     using (var taskManager = new TaskManagerEntities())
     {
         var tTask = taskManager.tblTasks.Where(t => t.TaskID == task.TaskID).FirstOrDefault();
         if (tTask != null)
         {
             tTask.ParentTask = task.ParentTask;
             tTask.Priority   = task.Priority;
             tTask.StartDate  = task.StartDate;
             tTask.EndDate    = task.EndDate;
             taskManager.SaveChanges();
         }
     }
 }
Пример #3
0
        public int AddTask(TaskBL task)
        {
            tblTask tTask = new tblTask
            {
                Task       = task.Task,
                ParentTask = task.ParentTask,
                Priority   = task.Priority,
                StartDate  = task.StartDate,
                EndDate    = task.EndDate,
                IsActive   = true
            };

            _taskManager.tblTasks.Add(tTask);
            int result = _taskManager.SaveChanges();

            return(result);
        }
Пример #4
0
        public void AddTask(TaskBL task)
        {
            using (var taskManager = new TaskManagerEntities())
            {
                tblTask tTask = new tblTask
                {
                    Task       = task.Task,
                    ParentTask = task.ParentTask,
                    Priority   = task.Priority,
                    StartDate  = task.StartDate,
                    EndDate    = task.EndDate,
                    IsActive   = true
                };

                taskManager.tblTasks.Add(tTask);
                taskManager.SaveChanges();
            }
        }
Пример #5
0
        public TaskBL GetTaskById(int taskId)
        {
            TaskBL task = new TaskBL();

            task = _taskManager.tblTasks
                   .Where(x => x.TaskID == taskId)
                   .Select(t => new TaskBL()
            {
                TaskID     = t.TaskID,
                Task       = t.Task,
                ParentTask = t.ParentTask,
                Priority   = t.Priority,
                StartDate  = t.StartDate,
                EndDate    = t.EndDate,
                IsActive   = t.IsActive
            }).FirstOrDefault();

            return(task);
        }