예제 #1
0
        // 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");
        }
예제 #2
0
        public void DeleteSlot(Expression <Func <Slot, bool> > where)
        {
            var ListSlot = _repository.GetMany(where);

            foreach (var Slot in ListSlot)
            {
                _repository.Delete(Slot);
            }
        }
예제 #3
0
        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" }));
        }
예제 #4
0
 public async Task <bool> Delete(Slot obj)
 {
     return(await repository.Delete(obj));
 }