コード例 #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
ファイル: SlotService.cs プロジェクト: binhtv1997/Bus
        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));
 }