Example #1
0
        /// <summary>
        /// Deletes a task from the database for a given id
        /// </summary>
        /// <param name="id">The id of the task to delete.</param>
        public void DelTask(int id)
        {
            ToDoTask toDoTask = new ToDoTask(this.resporitoryToDoTasks);

            ToDoTasksDataLayer.Entities.ToDoTasks entityTask = toDoTask.GetTasks(id);

            toDoTask.Del(entityTask);
        }
Example #2
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);
            }
        }
Example #3
0
        /// <summary>
        /// Get the individual task for a given taskid
        /// </summary>
        /// <param name="taskId">The task id</param>
        /// <returns>Returns a task object for use by the UI.</returns>
        public UIToDoTask GetTask(int taskId)
        {
            ToDoTasksDataLayer.Entities.ToDoTasks task = new ToDoTasksDataLayer.Entities.ToDoTasks();

            ToDoTask toDoTask = new ToDoTask(this.resporitoryToDoTasks);

            ToDoTasksDataLayer.Entities.ToDoTasks entityTask = toDoTask.GetTasks(taskId);


            Models.UIToDoTask uiToDoTask = new Models.UIToDoTask
            {
                ToDoTaskId      = entityTask.ToDoTaskId,
                CheckedDone     = entityTask.CheckedDone,
                LastUpdated     = entityTask.LastUpdated,
                TaskDescription = entityTask.TaskDescription,
                TaskUserId      = entityTask.TaskUserId
            };


            return(uiToDoTask);
        }