public ActionResult Delete(Guid id) { try { string roomId = string.Empty; var roomDetail = roomRepository.GetRoomById(id).FirstOrDefault(); roomId = roomRepository.DeleteRoom(id, LogInManager.LoggedInUserId); if (!string.IsNullOrWhiteSpace(roomId)) { #region Delete Room Features //Delete Room Features. roomRepository.DeleteRoomFeaturesMappingByRoom(id, LogInManager.LoggedInUserId); #endregion #region Update Floor (No. Of Rooms) //Decrease the no. of rooms quantity from floor. var floor = floorRepository.GetFloorById(roomDetail.FloorId).FirstOrDefault(); if (floor != null) { floor.NoOfRoom = floor.NoOfRoom > 0 ? (floor.NoOfRoom - 1) : 0; floorRepository.UpdateFloor(floor); } #endregion return(Json(new { IsSuccess = true, data = new { RoomId = id } }, JsonRequestBehavior.AllowGet)); } else { return(Json(new { IsSuccess = false, errorMessage = "Room not deleted successfully." }, JsonRequestBehavior.AllowGet)); } } catch (Exception e) { Utility.Utility.LogError(e, "Delete"); return(Json(new { IsSuccess = false, errorMessage = e.Message })); } }
public ActionResult Delete(int id) { //1. Create a RoomRepository RoomRepository roomRepository = new RoomRepository(); //2. Delete the Room roomRepository.DeleteRoom(id); //3. redirect to the index page return(RedirectToAction("Index")); }
public void DeleteRoom(string SelectedRoom) { var AllRooms = RoomRepo.LoadRooms(); foreach (var SingleRoom in AllRooms) { if (SingleRoom.RetrieveRoomName() == SelectedRoom) { RoomRepo.DeleteRoom(SelectedRoom); } } }
public Boolean DeleteRoom(int id) { roomRepository.DeleteRoom(id); return(true); }
public bool DeleteRoom(int number) { // TODO: implement return(roomRepository.DeleteRoom(number)); }
public void DeleteRoom(Room room) { _repository.DeleteRoom(room); }