コード例 #1
0
        public ActionResult View(int?id, bool?itemSaved)
        {
            if (System.Configuration.ConfigurationManager.AppSettings["IsHotel"].ToString() == "1")
            {
                var existingCompany  = _businessAccountService.GetById(id.Value);
                var allItemisedItems = existingCompany.Guests.SelectMany(x => x.SoldItemsAlls.Where(y => y.IsActive && y.PaymentMethodId == (int)PaymentMethodEnum.POSTBILL).OrderByDescending(y => y.DateSold).ToList()).ToList();
                var allPaymentsMade  = _businessAccountCorporateService.GetAll(HotelID).Where(x => x.BusinessAccountId == id.Value).ToList();

                var model = new SearchViewModel
                {
                    Company         = existingCompany,
                    AllPaymentsMade = allPaymentsMade.Where(x => x.PaymentMethodId == (int)PaymentMethodEnum.Cash).ToList(),
                    RoomAccounts    = existingCompany.GuestRooms.SelectMany(x => x.GuestRoomAccounts).ToList(),
                    ItemmisedItems  = allItemisedItems
                };

                return(View(model));
            }
            else
            {
                var existingCompany  = _businessAccountService.GetAllincludes("SoldItemsAlls,SoldItemsAlls.StockItem,SoldItemsAlls.Person,BusinessCorporateAccounts").FirstOrDefault(x => x.Id == id.Value);
                var allItemisedItems = existingCompany.SoldItemsAlls.Where(y => y.IsActive).ToList();
                var allPaymentsMade  = _businessAccountCorporateService.GetAll(HotelID).Where(x => x.BusinessAccountId == id.Value).ToList();

                var model = new SearchViewModel
                {
                    Company         = existingCompany,
                    AllPaymentsMade = allPaymentsMade.Where(x => x.PaymentMethodId == (int)PaymentMethodEnum.Cash).ToList(),
                    RoomAccounts    = existingCompany.GuestRooms.SelectMany(x => x.GuestRoomAccounts).ToList(),
                    ItemmisedItems  = allItemisedItems
                };

                return(View("RestauantView", model));
            }
        }
コード例 #2
0
        public ActionResult View(int?id, bool?itemSaved)
        {
            var existingCompany  = _businessAccountService.GetById(id.Value);
            var allItemisedItems = existingCompany.Guests.SelectMany(x => x.SoldItemsAlls.Where(y => y.PaymentMethodId == (int)PaymentMethodEnum.POSTBILL).OrderByDescending(y => y.DateSold).ToList()).ToList();
            var allPaymentsMade  = _businessAccountCorporateService.GetAll(HotelID).Where(x => x.BusinessAccountId == id.Value).ToList();

            var model = new SearchViewModel
            {
                Company         = existingCompany,
                AllPaymentsMade = allPaymentsMade,
                RoomAccounts    = existingCompany.GuestRooms.SelectMany(x => x.GuestRoomAccounts).ToList(),
                ItemmisedItems  = allItemisedItems
            };

            return(View(model));
        }