public static void UpdateFromModel(this PartInventory inv, PartInventoryModel model) { inv.InventoryId = model.InventoryId; inv.Quantity = model.Quantity; inv.MyPrice = model.MyPrice; inv.ColourId = model.ColourId; inv.ColourName = model.ColourName; inv.Condition = model.Condition; inv.Location = model.Location; inv.Image = model.Image; inv.Description = model.Description; inv.Notes = model.Notes; inv.LastUpdated = model.LastUpdated; }
public PartInventoryModel UpdateInventoryModelFromApi(int inventoryId) { var partInv = new PartInventoryModel(); var response = GetRequest <GetInventoryResponseModel>($"inventories/{inventoryId}"); var item = response.data; if (item == null) { return(null); } partInv.InventoryId = item.inventory_id; partInv.Quantity = item.quantity; partInv.MyPrice = decimal.Parse(item.unit_price); partInv.ColourId = item.color_id; partInv.ColourName = GetColour(item.color_id).Name; partInv.Condition = item.new_or_used; partInv.Location = item.remarks; partInv.Description = item.description; if (string.IsNullOrEmpty(partInv.Image)) { partInv.Image = GetItemImage(item.item.type, item.item.no, item.color_id); } if (string.IsNullOrEmpty(partInv.Location)) { partInv.Location = item.description; } partInv.LastUpdated = DateTime.UtcNow; partInv.Number = item.item.no; partInv.Name = item.item.name; partInv.ItemType = item.item.type; partInv.CategoryId = item.item.category_id; if (item.is_stock_room) { partInv.Location = ""; partInv.Quantity = 0; } return(partInv); }
public static PartInventory ToEntity(this PartInventoryModel model) { return(new PartInventory { Id = model.Id, InventoryId = model.InventoryId, Quantity = model.Quantity, MyPrice = model.MyPrice, ColourId = model.ColourId, ColourName = model.ColourName, Condition = model.Condition, Location = model.Location, Image = model.Image, Description = model.Description, Notes = model.Notes, LastUpdated = model.LastUpdated }); }
public DuplicateInventoryItemsModel(PartInventoryModel inv, IEnumerable <int> ids) { Inventory = inv; Ids = ids; }