public ActionResult Create(ContactViewModel model) { if (ModelState.IsValid) { var Contact = new Domain.Account.Entities.Contact(); AutoMapper.Mapper.Map(model, Contact); Contact.IsDeleted = false; Contact.CreatedUserId = WebSecurity.CurrentUserId; Contact.ModifiedUserId = WebSecurity.CurrentUserId; Contact.CreatedDate = DateTime.Now; Contact.ModifiedDate = DateTime.Now; ContactRepository.InsertContact(Contact); TempData[Globals.SuccessMessageKey] = App_GlobalResources.Wording.InsertSuccess; return(RedirectToAction("Index")); } return(View(model)); }
public ActionResult ContactCreate(ContactViewModel model) { var contact = new Domain.Account.Entities.Contact(); AutoMapper.Mapper.Map(model, contact); contact.IsDeleted = false; contact.CreatedDate = DateTime.Now; contact.CreatedUserId = WebSecurity.CurrentUserId; ContactRepository.InsertContact(contact); if (Request["IsPopup"] == "true") { ViewBag.closePopup = "close and append to page parent"; model.FullName = model.LastName + " " + model.FirstName; model.Id = contact.Id; return(View(model)); } return(RedirectToAction("ContactList", new { customerId = model.CustomerId, SupplierId = model.SupplierId })); }