public void InsertCustomerGroupEdit(CustomerGroupEditViewModel model) { var item = Mapper.Map <Customer_Groups>(model); m_ContentContext.Customer_Groups.Add(item); m_ContentContext.SaveChanges(); }
public ActionResult EditGroup(CustomerGroupEditViewModel model) { if (ModelState.IsValid) { try { m_customerWorker.UpdateManagerCustomerGroupEdit(model); return(RedirectToAction("Groups")); } catch (Exception ex) { ModelState.AddModelError("General", ex.Message); } } List <SelectListItem> priceIndexes = new List <SelectListItem>(); for (int i = 1; i <= 5; i++) { priceIndexes.Add(new SelectListItem { Text = i.ToString() + ". Fiyat", Value = i.ToString() }); } ViewBag.PriceIndex = priceIndexes; this.StatusList(model.Status); return(View(model)); }
public void UpdateManagerCustomerGroupEdit(CustomerGroupEditViewModel model) { var query = from g in m_ContentContext.Customer_Groups where g.Id == model.Id select g; var item = query.FirstOrDefault(); Mapper.Map(model, item); m_ContentContext.SaveChanges(); }
//GET: Admin/CustomerManager/CreateGroup public ActionResult CreateGroup() { List <SelectListItem> priceIndexes = new List <SelectListItem>(); for (int i = 1; i <= 5; i++) { priceIndexes.Add(new SelectListItem { Text = i.ToString() + ". Fiyat", Value = i.ToString() }); } ViewBag.PriceIndex = priceIndexes; var model = new CustomerGroupEditViewModel { Status = 1 }; this.StatusList(model.Status); return(View(model)); }