예제 #1
0
        /// <summary>
        /// updates a customer, inventory, and order history in the database
        /// </summary>
        /// <param name="location">location object to update the database with</param>
        public void UpdateLocation(Business.Location location)
        {
            Locations currentEntity = _context.Locations.Find(location.Id);
            Locations newEntity     = Mapper.MapLocationsToInvetoryToOrders(location);

            Log.Information("Updated location {Name}", location.Name);
            _context.Entry(currentEntity).CurrentValues.SetValues(newEntity);
        }
예제 #2
0
 /// <summary>
 /// converts a location object to a location entity
 /// </summary>
 /// <param name="location">location object to be converted</param>
 /// <returns>location entity</returns>
 public static Entities.Locations MapLocationsToInvetoryToOrders(Business.Location location)
 {
     return(new Entities.Locations
     {
         Id = location.Id,
         Name = location.Name,
         TotalSales = location.Total,
         ProductEntry = location.Inventory.Select(MapProductEnteries).ToList(),
         Orders = location.Orders.Select(MapOrder).ToList(),
     });
 }
 public LocationController()
 {
     _location = new Business.Location();
 }