/// <summary>
        /// This is another help method that just gets the stocks for a given location from the db.
        /// </summary>
        /// <param name="locationID"></param>
        /// <returns>A list of stocks to be assigned to the object that called it.</returns>
        public IEnumerable <Domain.Models.Stock> GetStocksForLocation(int locationID)
        {
            // since it is a location that exists we don't have to do much exception handling and we just get the inventories for the location including the book table
            IQueryable <Entities.InventoryEntity> stocks   = _context.Inventories.Include(b => b.BookIsbnNavigation).ThenInclude(g => g.Genre).Where(i => i.LocationId == locationID);
            List <Domain.Models.Stock>            m_stocks = new List <Domain.Models.Stock>();

            // assign each stock from the list of stocks to a model
            foreach (Entities.InventoryEntity s in stocks)
            {
                m_stocks.Add(MapperInventory.Map(s));
            }

            return(stocks.Select(MapperInventory.Map));
        }
Пример #2
0
 // GET: Inventory/Create
 public ActionResult Create()
 {
     return(this.View(MapperInventory.MInventoryEmpty()));
 }