コード例 #1
0
 public ResponseBaseModel DeleteToDo(int toDoId, int createBy)
 {
     try
     {
         var toDo = _toDoRepository.GetById(toDoId);
         if (toDo != null)
         {
             toDo.IsDeleted = true;
             _toDoRepository.Update(toDo);
             return(ResponseBaseModel.Success("Delete successfully"));
         }
         return(ResponseBaseModel.Success("ToDo not found!"));
     }catch (Exception ex)
     {
         return(ResponseBaseModel.Failed(ex.Message));
     }
 }
コード例 #2
0
 public ResponseBaseModel EditToDo(int toDoId, string title, string content, int status, int categoryId, int createBy)
 {
     try
     {
         var toDo = _toDoRepository.GetById(toDoId);
         if (toDo != null)
         {
             toDo.ToDoTitle   = title;
             toDo.ToDoContent = content;
             toDo.ToDoStatus  = (byte)status;
             toDo.CategoryID  = categoryId;
             _toDoRepository.Update(toDo);
             return(ResponseBaseModel.Success("Update successfully"));
         }
         return(ResponseBaseModel.Failed("Not found ToDo"));
     }
     catch (Exception ex)
     {
         return(ResponseBaseModel.Failed(ex.Message));
     }
 }