예제 #1
0
        public ActionResult DeleteGuest(string guestID, string secretPin)
        {
            //This will need to check if there exists outstanding charges.

            int   guestid = Convert.ToInt32(guestID);
            Guest guest   = _guestService.SearchByGuestId(guestid);

            if (guest.OutstandingChargesDetails() == 0)
            {
                // This will check for secret pin validity
                if (!_authenticator.AuthenticatePin(secretPin))
                {
                    TempData["DeleteGuestMessage"] = "InvalidPin";
                    return(RedirectToAction("Index", "Guest"));
                }
                _guestService.DeleteGuest(guestid);
                TempData["DeleteGuestMessage"] = "NoCharges";
                return(RedirectToAction("Index", "Guest"));
            }
            else
            {
                TempData["DeleteGuestMessage"] = "HasCharges";
                return(RedirectToAction("Index", "Guest"));
            }
        }
예제 #2
0
 public async Task <IActionResult> DeleteConfirmed(int id)
 {
     _guestService.DeleteGuest(id);
     ViewBag.Message = $"The guest with number {id} has deleted succesfully!";
     ViewBag.Succes  = 1;
     return(View(nameof(Index), await _guestService.AllGuests()));
 }
        public async Task <IActionResult> Delete(int id)
        {
            var userId = GetAuthorizedUserId();
            await _guestService.DeleteGuest(id, userId);

            return(NoContent());
        }
예제 #4
0
 /// <summary>
 /// Delete an item from the list
 /// </summary>
 /// <param name=<em>"id"</em>>id of the item to be deleted</param>
 // DELETE: api/Room/5
 public bool Delete(int id)
 {
     if (id >= 0)
     {
         return(_GuestService.DeleteGuest(id));
     }
     return(false);
 }
예제 #5
0
 public IActionResult DeleteConfirmed(int id)
 {
     _guestService.DeleteGuest(id);
     return(RedirectToAction(nameof(Index)));
 }