public IActionResult ViewItem(int id) { var model = _itemData.Get(id); if (model == null || model.Active == false) { return(RedirectToAction(nameof(Display))); } return(View(model)); }
public ReservationItemDetail(IItemData itemData, IReservationItemData reservationItemData, int reservationId, int itemId) { ReservationItem reservationItem = reservationItemData.Get(reservationId, itemId); ReservationId = reservationId; ItemId = itemId; Name = itemData.Get(itemId).Name; Amount = reservationItem.Amount; Price = reservationItem.Price; }
public ItemDetail(IBtwTypeData btwTypeData, ICatagoryData catagoryData, IItemData itemData, int itemId) { /* * IBtwTypeData btwTypeData = DependencyResolver.Current.GetService<IBtwTypeData>(); * ICatagoryData catagoryData = DependencyResolver.Current.GetService<ICatagoryData>(); * IItemData itemData = DependencyResolver.Current.GetService<IItemData>(); */ Item item = itemData.Get(itemId); Id = itemId; Name = item.Name; Description = item.Description; Price = item.Price; BtwPercentage = btwTypeData.Get(item.BtwTypeId).Percentage; CatagoryName = catagoryData.Get(item.CatagoryId).Name; Available = item.Available; }
public ItemsOfReservation(IReservationItemData reservationItemData, ITableData tableData, IItemData itemData, Reservation reservation, bool prepared, bool delivered, int?stationId = null) { TableNumber = tableData.Get(reservation.TableId).Number; List <ReservationItemDetail> newItems = new List <ReservationItemDetail>(); IEnumerable <ReservationItem> reservationItems = reservationItemData.Get(reservation.Id).Where(o => o.Prepared == prepared && o.Delivered == delivered); foreach (ReservationItem reservationItem in reservationItems) { if (stationId != null) { if (itemData.Get(reservationItem.ItemId).StationId == stationId) { newItems.Add(new ReservationItemDetail(itemData, reservationItemData, reservation.Id, reservationItem.ItemId)); } } else { newItems.Add(new ReservationItemDetail(itemData, reservationItemData, reservation.Id, reservationItem.ItemId)); } } Items = newItems; }
public IActionResult Details(int id) { var model = _itemData.Get(id); return(View(model)); }