public ActionResult Create(Brand brand) { if (ModelState.IsValid) { db.Brand.Add(brand); db.SaveChanges(); return RedirectToAction("Index"); } return View(brand); }
/// <summary> /// Create a new Brand object. /// </summary> /// <param name="brandId">Initial value of the BrandId property.</param> /// <param name="brandName">Initial value of the BrandName property.</param> public static Brand CreateBrand(global::System.Int32 brandId, global::System.String brandName) { Brand brand = new Brand(); brand.BrandId = brandId; brand.BrandName = brandName; return brand; }
/// <summary> /// Deprecated Method for adding a new object to the Brands EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToBrands(Brand brand) { base.AddObject("Brands", brand); }
public ActionResult Edit(Brand brand) { if (ModelState.IsValid) { db.Entry(brand).State = EntityState.Modified; db.SaveChanges(); return RedirectToAction("Index"); } return View(brand); }