/// <summary> /// Maps a Domain Location to an entity Location /// </summary> /// <param name="locDom">A Domain Location</param> /// <returns>An Entity Location</returns> public static Entities.Location MapLocation(dom.Location locDom) { return(new Entities.Location { LocationId = 0, LocationName = locDom.StoreName, LocationAddress = locDom.Address }); }
/// <summary> /// Maps an Entity Location to a Domain Location /// </summary> /// <param name="locEnt">An Entity Location</param> /// <returns>A Domain Location</returns> public static dom.Location MapLocation(Entities.Location locEnt) { var loc = new dom.Location(locEnt.LocationName, locEnt.LocationAddress, locEnt.LocationId); foreach (Entities.Inventory item in locEnt.Inventory) { var prod = MapProduct(item.Product); loc.AddNewItem(prod, item.Quantity); } return(loc); }
/// <summary> /// Maps an Domain Location's inventory to a List of Entity Inventories /// </summary> /// <param name="locDom">A Domain Location</param> /// <returns>A List of Entity Inventories</returns> public static IEnumerable <Entities.Inventory> MapInventory(dom.Location locDom) { var list = new List <Entities.Inventory> { }; foreach (KeyValuePair <dom.Product, int> item in locDom.inventory) { list.Add(new Entities.Inventory { ProductId = item.Key.ProductID, Quantity = item.Value, LocationId = locDom.StoreID }); } return(list); }