/// <summary> /// Turn a location into an entity location /// </summary> /// <param name="location"></param> /// <returns></returns> public static Domain.Models.Location Map(Entities.LocationEntity location) { return(new Domain.Models.Location { ID = location.Id, LocationName = location.Name }); }
/// <summary> /// Turn a location into an entity location /// </summary> /// <param name="location"></param> /// <returns></returns> public static Library.Models.Location Map(Entities.LocationEntity location) { return(new Library.Models.Location { ID = location.Id, LocationName = location.Name }); }
/// <summary> /// turn an entity location with their inventory into a model inventory /// </summary> /// <param name="location"></param> /// <returns></returns> public static Library.Models.Location MapLocationsWithInventory(Entities.LocationEntity location) { return(new Library.Models.Location { ID = location.Id, LocationName = location.Name, Inventory = location.Inventories.Select(Mapper_Inventory.Map).ToList() }); }
/// <summary> /// This turns a Location Entity into a Location model. /// </summary> /// <param name="customer">The customer entity.</param> /// <returns></returns> public static Library.Models.Location MapLocationWithOrders(Entities.LocationEntity location) { return(new Library.Models.Location { ID = location.Id, LocationName = location.Name, OrderHistory = location.Orders.Select(Mapper_Order.MapOrderWithOrderLines).ToList() }); }
public static Location MapToLocation(Entities.LocationEntity dbLocation) { if (dbLocation == null) { return(null); } return(new Location { Id = dbLocation.Id, Name = dbLocation.Name, CreatedBy = dbLocation.CreatedBy, CreatedOn = dbLocation.CreatedOn, UpdatedBy = dbLocation.UpdatedBy, UpdatedOn = dbLocation.UpdatedOn, }); }
public static Location MapToLocation(Entities.LocationEntity dbLocation) { if (dbLocation == null) { return(null); } return(new Location { Cidr = dbLocation.Cidr, Id = dbLocation.Id, Name = dbLocation.Name, Net = dbLocation.Net_Address_v4, CreatedBy = dbLocation.CreatedBy, CreatedOn = dbLocation.CreatedOn, UpdatedBy = dbLocation.UpdatedBy, UpdatedOn = dbLocation.UpdatedOn, }); }
/// <summary> /// The purpose is to turn the db information for a given locations order history into readable text. /// </summary> /// <param name="locationID"></param> /// <returns></returns> public IEnumerable <Domain.Models.Order> GetOrderHistoryByLocationID(int locationID) { // This method is called because we need the information on the whole catalog // Since the catalog is small I went with this implementation. // If it was much large I would only fill the Domain with the relevant books FillBookLibrary(); // Find if the location exists and include all information including orders and their orderlines Entities.LocationEntity dbLocation = _context.Locations .Include(o => o.Orders) .ThenInclude(c => c.Orderlines) .FirstOrDefault(l => l.Id == locationID); // If it doesn't exist then return that the location does not exist. if (dbLocation == null) { return(new List <Domain.Models.Order>()); } return(dbLocation.Orders.Select(MapperOrder.MapOrderWithOrderLines)); }