public ActionResult Index() { var ManagementData = new ManagementDTO() { ManagementList = db.Managements.ToList() }; return(View(ManagementData)); }
public ActionResult Edit(int id) { var ManagementData = new ManagementDTO() { ManagementList = db.Managements.ToList(), ManagementData = db.Managements.FirstOrDefault(x => x.Id == id) }; return(View("Index", ManagementData)); }
public ActionResult Index(ManagementDTO manage) { if (manage.ManagementData.Id == 0) { db.Managements.Add(manage.ManagementData); db.SaveChanges(); } else { var dataManage = db.Managements.FirstOrDefault(a => a.Id == manage.ManagementData.Id); dataManage.Email = manage.ManagementData.Email; dataManage.Password = manage.ManagementData.Password; db.SaveChanges(); } return(RedirectToAction("Index")); }