コード例 #1
0
 public IActionResult DeleteSpecialist(int?id)
 {
     if (id == null)
     {
         Response.StatusCode = 404;
         return(null);
     }
     specialistManagementService.Delete((int)id);
     return(RedirectToAction("Specialists"));
 }
コード例 #2
0
        public Result <int> Delete(int id)
        {
            SpecialistDTO specialist = specialistManagementService.GetById(id);

            if (specialist == null)
            {
                return new Result <int>()
                       {
                           MessageType = MessageType.NotFound, MessageText = $"Specialist with id {id} was not found"
                       }
            }
            ;

            specialistManagementService.Delete(id);
            return(new Result <int>(id)
            {
                MessageType = MessageType.Ok, MessageText = $"Specialist with ID {id} was successfully deleted"
            });
        }
    }