public void CanAddProduct() { ProductType productType = new ProductType(00, "product", 5.99, 10); productRepository.Add(productType); Assert.AreEqual(productType, productRepository.GetProduct(00)); }
public ActionResult SetTranslation(int _LanguageID, string type, string name) { try { using (var unit = GetUnitOfWork()) { var repo = new ProductTypeRepository(unit, _defaultVendorID); var record = repo.GetAll().FirstOrDefault(x => x.Type == type); if (record == null) { repo.Add(new ProductTypeModel { Type = type }); } repo.Update(type, name, record.IsBra, (record != null && record.ProductType == null ? string.Empty : record.ProductType.ToString()), _LanguageID); unit.Save(); return(Success("Update translation successfully")); } } catch (Exception e) { return(Failure("Something went wrong: ", e)); } }
public ActionResult Create(ProductTypeModel model) { try { using (var unit = GetUnitOfWork()) { var repo = new ProductTypeRepository(unit, _defaultVendorID); repo.Add(model); } return(Success("Successfully added type")); } catch (Exception e) { return(Failure("Something went wrong ", e)); } }
public IActionResult CreateProductType(ProductType productType) { _repo.Add(productType); return(Created($"/api/producttype/{productType.ProductTypeId}", productType)); }
private void Init() { productTypeRepository.Add(new ProductType(1, "Gel", 30.0, 20)); productTypeRepository.Add(new ProductType(2, "Extra large gel", 50.0, 10)); }