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); }
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); }