public void Test2() { var booking = new BookingRepository(Bookingcontextmock.Object); var x = booking.DeleteBooking(1); Assert.IsNotNull(x); }
public ActionResult Delete(Guid id, FormCollection collection) { try { var userId = User.Identity.GetUserName(); if (userRoleRepository.GetRoleByUserName(userId) != null) { var userRole = userRoleRepository.GetRoleByUserName(userId).IdUserType; var userDepartment = userRoleRepository.GetRoleByUserName(userId).IdDepartment; var filterDepartmentId = departmentRepository.GetDepartmentIdByName(userDepartment); // TODO: Add delete logic here bookingRepository.DeleteBooking(id); return(RedirectToAction("Index")); } else { return(RedirectToAction("Contact", "Home")); } } catch { return(View("DeleteBooking")); } }
public bool DeleteBooking(Guid bookingId) { var logger = LogManager.GetLogger("BookingService"); var booking = BookingRepository.GetBookingById(bookingId); if (booking == null) { logger.Warn($"No booking found for bookingId {bookingId}"); return(false); } BookingRepository.DeleteBooking(booking); return(true); }
public bool CancelBooking(Guid pBookingID) { bool IsComplete = false; try { lBookingRepository.DeleteBooking(pBookingID); lBookingRepository.DeleteTableBooking(pBookingID); lBookingRepository.Save(); } catch (Exception ex) { throw new Exception(String.Concat("Booking not removed! Error: ", ex.ToString()), new Exception(ex.ToString())); } finally { IsComplete = true; } return(IsComplete); }