Exemplo n.º 1
0
        public int AddEditTask(TaskModel taskModel, int createdUserId)
        {
            taskModel.CreatedUserId = createdUserId;

            if (taskModel.Id == -1)
            {
                return CreateTask(taskModel);
            }
            else
            {
                return EditTask(taskModel);
            }
        }
Exemplo n.º 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;
        }
Exemplo n.º 3
0
 public JsonResult EditTask(TaskModel task)
 {
     return Json(oper.AddEditTask(task, HttpUserData.Get().Id), JsonRequestBehavior.DenyGet);
 }
Exemplo n.º 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;
        }