예제 #1
0
        public ToDoResponse Create(ToDoViewModel li)
        {
            ToDoResponse response = new ToDoResponse();

            try
            {
                ToDo addedToDo = unitOfWork.GetToDoRepository().Create(li.ConvertToToDo());
                unitOfWork.Save();

                response.ToDo    = addedToDo.ConvertToToDoViewModel();
                response.Success = true;
            }
            catch (Exception ex)
            {
                response.ToDo    = new ToDoViewModel();
                response.Success = false;
                response.Message = ex.Message;
            }

            return(response);
        }
예제 #2
0
        public ToDoResponse Delete(Guid identifier)
        {
            ToDoResponse response = new ToDoResponse();

            try
            {
                ToDo deletedToDo = unitOfWork.GetToDoRepository().Delete(identifier);

                unitOfWork.Save();

                response.ToDo    = deletedToDo?.ConvertToToDoViewModel();
                response.Success = true;
            }
            catch (Exception ex)
            {
                response.ToDo    = new ToDoViewModel();
                response.Success = false;
                response.Message = ex.Message;
            }

            return(response);
        }