Exemplo n.º 1
0
 // public Models.Inventory ParseInventory(Entities.Inventory inventory) {
 //     return new Models.Inventory();
 // }
 // public Entities.Inventory ParseInventory(Models.Inventory inventory) {
 //     return new Entities.Inventory();
 // }
 public Models.Location ParseLocation(Entities.Location location)
 {
     Models.Location loc = new Models.Location();
     loc.LocationID   = location.LocationId;
     loc.LocationName = location.LocationName;
     loc.Address      = location.LocationAddress;
     return(loc);
 }
Exemplo n.º 2
0
 public Model.Location ParseLocation(Entities.Location location)
 {
     return(new Model.Location
     {
         LocationName = location.LocationName,
         LocationID = location.LocationId,
         Address = location.LocationAddress
     });
 }
Exemplo n.º 3
0
 public Entities.Location ParseLocation(Models.Location location)
 {
     Entities.Location loc = new Entities.Location();
     if (location.LocationID != null)
     {
         loc.LocationId = (int)location.LocationID;
     }
     loc.LocationName    = location.LocationName;
     loc.LocationAddress = location.Address;
     return(loc);
 }
        public List <Inventory> GetInventory()
        {
            //retrieve all inventories
            List <Inventory> inventorys = _context.Inventories.Select(x => _mapper.ParseInventory(x)).ToList();

            //for each inventory
            foreach (Inventory inventory in inventorys)
            {
                //assign a location object to it (one inventory can only have one location)
                Entity.Location location = _context.Locations.Find(inventory.InventoryLocation);
                Entity.Product  product  = _context.Products.Find(inventory.ProductID);
                inventory.Location = _mapper.ParseLocation(location);
                inventory.Product  = _mapper.ParseProduct(product);
            }

            return(inventorys);
        }
Exemplo n.º 5
0
 public Location GetSpecifiedLocation(int locationID)
 {
     Entities.Location location = _context.Locations.Find(locationID);
     return(_mapper.ParseLocation(location));
 }