예제 #1
0
        public int AddEditTask(TaskModel taskModel, int createdUserId)
        {
            taskModel.CreatedUserId = createdUserId;

            if (taskModel.Id == -1)
            {
                return CreateTask(taskModel);
            }
            else
            {
                return EditTask(taskModel);
            }
        }
예제 #2
0
        public int CreateTask(TaskModel taskModel)
        {
            Task task = new Task();
            task.Summary = taskModel.Summary;
            task.Description = taskModel.Description;
            task.Completed = taskModel.Completed;
            task.CreatedUserId = taskModel.CreatedUserId;
            task.DueDate = taskModel.DueDate;

            entities.Tasks.Add(task);
            entities.SaveChanges();

            return task.TaskId;
        }
예제 #3
0
 public JsonResult EditTask(TaskModel task)
 {
     return Json(oper.AddEditTask(task, HttpUserData.Get().Id), JsonRequestBehavior.DenyGet);
 }
예제 #4
0
        private int EditTask(TaskModel taskModel)
        {
            Task task = entities.Tasks.First(t => t.TaskId == taskModel.Id);

            task.Summary = taskModel.Summary;
            task.Description = taskModel.Description;
            task.DueDate = taskModel.DueDate;

            SaveChanges();

            return task.TaskId;
        }