public ActionResult EditContact(ViewCustomerContact contact) { var Data = new CustomerContact { Id = contact.Id, CustomerId = contact.CustomerId, ContactName = contact.ContactName, Title = contact.Title, JobPosition = contact.JobPosition, Email = contact.Email, Phone = contact.Phone, Mobile = contact.Mobile, Notes = contact.Notes, UpdatedDate = DateTime.Now, UpdatedBy = User.Identity.Name }; if (ModelState.IsValid) { db.Entry(Data).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Details/" + Data.CustomerId)); } return(View(contact)); }
public ActionResult CreateContact(ViewCustomerContact contact) { var Data = new CustomerContact { CustomerId = contact.CustomerId, Title = contact.Title, JobPosition = contact.JobPosition, ContactName = contact.ContactName, Email = contact.Email, Phone = contact.Phone, Mobile = contact.Mobile, Notes = contact.Notes, CreatedBy = User.Identity.Name, CreatedDate = DateTime.Now }; if (ModelState.IsValid) { db.CustomerContacts.Add(Data); db.SaveChanges(); return(RedirectToAction("Details/" + Data.CustomerId)); } return(View(contact)); }