public ActionResult Edit([Bind(Include = "Id,Name,LastName,BirthDate,Email,Password,Phone,Mobile,Department,Role,HireDate,TerminationDate,BaseSalary,Address,Address2,SSN,CURP,CLABE")] Employee employee) { if (ModelState.IsValid) { db.Entry(employee).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(employee)); }
public ActionResult Edit([Bind(Include = "Id,Code,Amount,Description,ExpirationDate,CreatedDate,Type")] PromoCode promoCode) { if (ModelState.IsValid) { db.Entry(promoCode).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(promoCode)); }
public ActionResult Edit([Bind(Include = "Id,Name,LastName,Email,Password,BirthDate,ContactNumber")] ClientViewModel clientVM, FormCollection form) { var cityId = Convert.ToInt32(form["City"]); if (db.Cities.Any(c => c.Id == cityId)) { var city = db.Cities.First(c => c.Id == cityId); clientVM.City = city; } var mapper = new ClientMapper(); var client = mapper.ClientViewModelToClient(clientVM); if (ModelState.IsValid) { db.Entry(client).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(clientVM)); }