예제 #1
0
        /// <summary>
        /// Adds new or updates a task object to the database
        /// </summary>
        /// <param name="uiTask">The task object to save</param>
        public void Save(Models.UIToDoTask uiTask)
        {
            ToDoTask toDoTask = new ToDoTask(this.resporitoryToDoTasks);

            ToDoTasksDataLayer.Entities.ToDoTasks task = new ToDoTasksDataLayer.Entities.ToDoTasks
            {
                CheckedDone     = uiTask.CheckedDone,
                LastUpdated     = uiTask.LastUpdated,
                TaskDescription = HttpUtility.HtmlEncode(uiTask.TaskDescription),
                TaskUserId      = uiTask.TaskUserId,
                ToDoTaskId      = uiTask.ToDoTaskId
            };
            if (task.ToDoTaskId == 0)
            {
                toDoTask.SaveNew(task);
            }
            else
            {
                toDoTask.UpdateTask(task);
            }
        }