public int AddInventoryItem(string json) { InventoryItem ii = InventoryItem.FromJsonString(json); if (!Validate.NameValidation(ii.Name)) { throw new ValidationException("Invalid name"); } if (!Validate.NameValidation(ii.Description)) { throw new ValidationException("Invalid description"); } if (!Validate.NumberValidation(ii.Barcode)) { throw new ValidationException("Invalid barcode"); } InventoryItemPM item = new InventoryItemPM() { Name = ii.Name, Description = ii.Description, Barcode = ii.Barcode, Price = ii.Price, InventoryGroupIdRef = ii.InventoryGroupIdRef, }; return(_posRepository.AddInventoryItem(item, GetCurrentUserId())); }