예제 #1
0
        public void Test2()
        {
            var booking = new BookingRepository(Bookingcontextmock.Object);
            var x       = booking.DeleteBooking(1);

            Assert.IsNotNull(x);
        }
예제 #2
0
        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"));
            }
        }
예제 #3
0
        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);
        }
예제 #4
0
        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);
        }