public void UpdateManagerCustomerEntityEdit(CustomerEntityEditViewModel model) { var query = from e in m_ContentContext.Customer_Entities where e.Id == model.Id select e; var item = query.FirstOrDefault(); item.BirthDate = model.BirthDate; item.Title = model.Caption; item.Company = model.Company; item.ContactPhone = model.ContactPhone; item.CustomerType = model.CustomerType; item.Gender = model.Gender; item.GroupId = model.GroupId; item.Status = model.Status; item.TaxNr = model.TaxNr; item.TaxOffice = model.TaxOffice; m_ContentContext.SaveChanges(); }
public ActionResult Edit(CustomerEntityEditViewModel model) { if (ModelState.IsValid) { try { m_customerWorker.UpdateManagerCustomerEntityEdit(model); return(RedirectToAction("Index")); } catch (Exception ex) { ModelState.AddModelError("General", ex.Message); } } this.StatusList(model.Status); ViewBag.Gender = CustomerEntityListProvider.GetGenderList().Select(item => new SelectListItem { Text = item.Value, Value = item.Key.ToString(), Selected = item.Key == model.Gender }).ToList(); this.Pair2List <CustomerEntityEditViewModel, short, short>(CustomerEntityListProvider.GetCustomerTypeList(), p => p.CustomerType, model.CustomerType.ToString()); ViewBag.GroupId = m_customerWorker.GetCustomerGroupList(1).Select(item => new SelectListItem { Text = item.Title, Value = item.Id.ToString(), Selected = item.Id == model.GroupId }).ToList(); return(View(model)); }