public void AddBrand(Entity.Brand brand) { using (DBContext context = new DBContext()) { context.brand.Add(brand); context.SaveChanges(); } }
public int Create(Brand item) { Entity.Brand brand = new Entity.Brand(); brand.id = item.id; brand.name = item.name; database.Brands.Add(brand); database.SaveChanges(); return(1); }
public ActionResult AddBrand(Models.Brand brand) { if (ModelState.IsValid) { Entity.Brand brandDetails = new Entity.Brand() { BrandName = brand.BrandName, }; mobileBL.AddBrand(brandDetails); return(RedirectToAction("Create")); } return(View()); }
public void AddBrand(Entity.Brand brand) { using (DBContext context = new DBContext()) { using (var transaction = context.Database.BeginTransaction()) { try { SqlParameter BrandName = new SqlParameter("@BrandName", brand.BrandName); var result = context.Database.ExecuteSqlCommand("Brand_Insert @BrandName ", BrandName); transaction.Commit(); } catch { transaction.Rollback(); } } } }
public void AddBrand(Entity.Brand brand) { BrandRepository repository = new BrandRepository(); repository.AddBrand(brand); }