public void InsertManagerCatalogBrandEdit(CatalogBrandEditViewModel model) { var item = Mapper.Map <Catalog_Brands>(model); m_ContentContext.Catalog_Brands.Add(item); m_ContentContext.SaveChanges(); }
//GET: Admin/CatalogManager/CreateBrand public ActionResult CreateBrand() { var model = new CatalogBrandEditViewModel { Status = 1 }; this.StatusList(1); return(View(model)); }
public void UpdateManagerCatalogBrandEdit(CatalogBrandEditViewModel model) { var query = from b in m_ContentContext.Catalog_Brands where b.Id == model.Id select b; var item = query.FirstOrDefault(); Mapper.Map(model, item); m_ContentContext.SaveChanges(); }
public ActionResult EditBrand(CatalogBrandEditViewModel model) { if (ModelState.IsValid) { try { m_catalogWorker.UpdateManagerCatalogBrandEdit(model); return(RedirectToAction("Brands")); } catch (Exception ex) { ModelState.AddModelError("General", ex.Message); } } this.StatusList(model.Status); return(View(model)); }