// GET: Slots/Delete public IActionResult Delete(string RoomID, String StartTime) { //Check the RoomID & StartTime fields are there if ((string.IsNullOrEmpty(RoomID)) && (string.IsNullOrEmpty(StartTime))) { return NotFound(); } //Try get the DateTime from the input string StartTime if (!(DateTime.TryParse(StartTime, out DateTime startTimeValue))) { return NotFound(); } //Find the selected slot from the repo/db var selectedSlot = _repo.Find(RoomID, startTimeValue); //if null then nothing was found if (selectedSlot == null) { return NotFound(); } else { _repo.Delete(selectedSlot); } return View("~/Views/Slots/SuccessfulBooking.cshtml"); }
public void DeleteSlot(Expression <Func <Slot, bool> > where) { var ListSlot = _repository.GetMany(where); foreach (var Slot in ListSlot) { _repository.Delete(Slot); } }
public IActionResult Delete([FromBody] Slot slot) { var deletedSlot = repo.Delete(slot); if (deletedSlot) { return(Ok(new { status = "success", message = "Staff has been deleted" })); } return(NotFound(new { status = "fail", message = "Cannot delete slot" })); }
public async Task <bool> Delete(Slot obj) { return(await repository.Delete(obj)); }