public ActionResult <Shift> DeleteShift(int id) { var shift = _shiftRepo.DeleteShift(id); if (shift == null) { return(NotFound()); } return(shift); }
public async Task <IActionResult> DeleteShift(int shiftId) { var shift = await _shiftRepository.GetShift(shiftId); if (shift == null) { return(new NotFoundResult()); } _shiftRepository.DeleteShift(shift); await _shiftRepository.SaveChanges(); return(new OkResult()); }
public ActionResult Deleteshift(int shiftId) { Console.WriteLine("I was called"); var shiftFromRepo = _shiftRepository.GetShift(shiftId); if (shiftFromRepo == null) { return(NotFound()); } _shiftRepository.DeleteShift(shiftFromRepo); _shiftRepository.Save(); return(NoContent()); }