public ActionResult ShowAllPage()
        {
            List <ClientModel> list;

            using (var database = new LogicLL())
                list = mapper.Map <List <ClientModel> >(database.GetAllClients());

            return(View(list));
        }
Пример #2
0
        public ActionResult ShowAll()
        {
            List <HolidayListModel> holidays;

            using (var database = new LogicLL())
                holidays = mapper.Map <List <HolidayListModel> >(database.GetAllHolidayList());

            return(View(holidays));
        }
Пример #3
0
        public ActionResult CreatePageName()
        {
            List <ClientModel> allClients;

            using (var database = new LogicLL())
                allClients = mapper.Map <List <ClientModel> >(database.GetAllClients());

            ViewData["AllClients"] = allClients;
            return(View(allClients));
        }
Пример #4
0
        public ActionResult EditPrice(Guid id)
        {
            RoomPriceModel roomPrice;

            using (var database = new LogicLL())
                roomPrice = (mapper.Map <List <RoomPriceModel> >(database.GetAllRoomPrice()))
                            .Where(x => x.Id == id).Single();

            return(View(roomPrice));
        }
Пример #5
0
        public ActionResult Delete(Guid id) //DeletePage
        {
            HolidayListModel holiday;

            using (var database = new LogicLL())
                holiday = (mapper.Map <List <HolidayListModel> >(database.GetAllHolidayList()))
                          .Where(x => x.Id == id)
                          .First();

            return(View(holiday));
        }
Пример #6
0
        public ActionResult ShowAll() //ShowAllPage
        {
            List <BookingModel> allBookings;

            using (var database = new LogicLL())
            {
                allBookings = mapper.Map <List <BookingModel> >(database.GetAllBookings()).ToList();
            }

            return(View(allBookings));
        }
        public ActionResult EditPage(Guid id)
        {
            ClientModel client;

            using (var database = new LogicLL())
                client = (mapper.Map <List <ClientModel> >(database.GetAllClients()))
                         .Where(x => x.Id == id)
                         .First();

            return(View(client));
        }
Пример #8
0
        public ActionResult ShowAllPage()
        {
            List <RoomModel> list;

            using (var database = new LogicLL())
                list = mapper.Map <List <RoomModel> >(database.GetAllRooms())
                       .OrderBy(i => i.RoomNumber)
                       .ToList();

            return(View(list));
        }
Пример #9
0
        public ActionResult EditPage(Guid id)
        {
            RoomModel room;

            using (var database = new LogicLL())
                room = (mapper.Map <List <RoomModel> >(database.GetAllRooms()))
                       .Where(i => i.Id == id)
                       .First();

            return(View(room));
        }
        //TODO:
        public ActionResult Invoice(Guid id)//InvoiceClient
        {
            InvoiceModel invoice;

            using (var database = new LogicLL())
                invoice = (mapper.Map <List <BookingModel> >(database.GetAllBookings()))
                          .Where(x => x.Id == id)
                          .Select(x => x.Invoice)
                          .First();

            return(View(invoice));
        }
        //TODO:
        public ActionResult HistoryClient(Guid id)
        {
            List <BookingModel> bookingHistory = new List <BookingModel>();

            using (var database = new LogicLL())
            {
                bookingHistory = (mapper.Map <List <BookingModel> >(database.GetAllBookings()))
                                 .Where(x => x.Client.Id == id).ToList();
            }

            return(View(bookingHistory));
        }
Пример #12
0
        public ActionResult SavePrice(RoomPriceModel roomPrice)
        {
            try
            {
                using (var database = new LogicLL())
                    database.UpdateRoomPrice(mapper.Map <RoomPriceLL>(roomPrice));

                return(RedirectToAction("ShowAvailablePage"));
            }
            catch (Exception ex)
            {
                return(View());
            }
        }
Пример #13
0
        public ActionResult Create(HolidayListModel holiday) //CreateHoliday
        {
            try
            {
                using (var database = new LogicLL())
                    database.AddHoliday(mapper.Map <HolidayListLL>(holiday));

                return(RedirectToAction(nameof(ShowAll)));
            }
            catch (Exception ex)
            {
                return(View());
            }
        }
        public ActionResult SaveClient(ClientModel client)
        {
            try
            {
                using (var database = new LogicLL())
                    database.UpdateClient(mapper.Map <ClientLL>(client));

                return(RedirectToAction("ShowAllPage"));
            }
            catch
            {
                return(View());
            }
        }
Пример #15
0
        public ActionResult Delete(HolidayListModel holiday) //DeletePage
        {
            try
            {
                using (var database = new LogicLL())
                    database.RemoveHoliday(holiday.Id);

                return(RedirectToAction(nameof(ShowAll)));
            }
            catch
            {
                return(View());
            }
        }
        public ActionResult SearchPage(string searchString)
        {
            if (String.IsNullOrWhiteSpace(searchString))
            {
                return(RedirectToAction("SearchPage"));
            }

            List <ClientModel> output;

            using (var database = new LogicLL())
                output = mapper.Map <List <ClientModel> >(database.GetAllClients());

            output.Where(x => JsonConvert.SerializeObject(x).Contains(searchString));

            return(View(output));
        }
Пример #17
0
 public ActionResult CreateRoom(RoomModel room)
 {
     try
     {
         using (var database = new LogicLL())
         {
             database.AddRoom(mapper.Map <RoomLL>(room));
             room = mapper.Map <List <RoomModel> >(database.GetAllRooms())
                    .ToList().Last();
             room.RoomPrice.RoomId = room.Id;
         }
         return(RedirectToAction("PricePage", room.RoomPrice)); //PricePage
     }
     catch (Exception ex)
     {
         return(View());
     }
 }
Пример #18
0
        public ActionResult CreatePage(string id)
        {
            BookingModel booking;

            using (var database = new LogicLL())
            {
                database.AddBooking(mapper.Map <BookingLL>(new BookingModel()));
                booking = mapper.Map <BookingModel>(database.GetAllBookings().Last());
            }



            //clients = mapper.Map<List<ClientModel>>(database.GetAllClients());

            //List<string> clientNames = new List<string>();

            //foreach (var cl in clients)
            //    clientNames.Add(cl.ClientFullName);

            //ViewData["ClientList"] = clientNames;

            return(View());
        }