public ActionResult Edite(CustomerDetails CustomerDetails, int id, Contacts Conts,string Id) { string myuser = User.Identity.Name; string userHostAddress = HttpContext.Request.UserHostAddress; var model = _userManager.FindById(Id); Conts.EditedId = User.Identity.GetUserName(); if (ModelState.IsValid) { // chkContacts(contacts); db.ContactsList.Add(chkContacts(Conts)); db.SaveChanges(); } Contacts bookStatus = db.ContactsList.Single(p => p.contact_Id == Conts.contact_Id); CustomerDetails CustomerDetail = db.CustomerDetails.Single(p => p.CustomerDetailsId == id); bookStatus.Customer_Name = CustomerDetails.CUST_NAME_1; bookStatus.Customer_No = CustomerDetails.AccountNo; bookStatus.Address_Line1 = CustomerDetails.CUST_NAME_2; bookStatus.Address_Line2 = CustomerDetails.STREET_ADDR; bookStatus.Address_Line3 = CustomerDetails.CITY_CTY_ADDR; bookStatus.Email_address1 = CustomerDetails.Email_address1; bookStatus.Email_address2 = CustomerDetails.Email_address2; bookStatus.AccountNo = CustomerDetails.Customer_No; db.ContactsList.Add(chkContacts(bookStatus)); db.Entry(bookStatus).State = EntityState.Modified; db.SaveChanges(); _getVals.LogAudit(User.Identity.GetUserName(), "Edit Contact", Request.UserHostName, "Edited Contact Details of {" + Conts.Customer_Name + "\t" + Conts.Customer_No + " : Edited By User { " + User.Identity.GetUserName() + " } " + model.UserName, "Edit", "Contacts"); return RedirectToAction("Index"); }
private List<CustomerDetailsmap> generatecustdetails(List<CustomerDetails> cheqBkReports) { List<CustomerDetailsmap> report = new List<CustomerDetailsmap>(); foreach (CustomerDetails chkBk in cheqBkReports) { List<CustomerDetails> contactObj = db.CustomerDetails.Where(c => c.CustomerDetailsId != 0).ToList<CustomerDetails>(); CustomerDetails contact = new CustomerDetails(); foreach (CustomerDetails tempContact in contactObj) { contact = tempContact; } CustomerDetailsmap temp = new CustomerDetailsmap(); temp.CUST_NAME_1 = chkBk.CUST_NAME_1; temp.Address_Line1 = chkBk.Address_Line1; // temp.BaseNumber = contact.AccountNo; //temp.Address_Line2 = chkBk.Address_Line2; //temp.StartSerial = chkBk.ckStartSerial; //temp.RequestDate = chkBk.fileCreationDate; //temp.DateReceived = chkBk.dateReceived; report.Add(temp); } return report; }