public ActionResult Edit(CLTeams clteams) { if (ModelState.IsValid) { db.Entry(clteams).State = EntityState.Modified; db.SaveChanges(); return RedirectToAction("Index"); } return View(clteams); }
public ActionResult Create(CLTeams clteams) { if (ModelState.IsValid) { db.CLTeams.Add(clteams); db.SaveChanges(); return RedirectToAction("Index"); } return View(clteams); }
public ActionResult Edit(EAppsModels eappsmodels) { if (ModelState.IsValid) { if (eappsmodels.GroupAssigned == "CLTeamUsers") { // create model and get the values from the old model CLTeams CLTeams = new CLTeams(); CLTeams.Agent = eappsmodels.Agent; CLTeams.Application = eappsmodels.Application; CLTeams.Comments = eappsmodels.Comments; CLTeams.GroupAssigned = eappsmodels.GroupAssigned; CLTeams.Received = eappsmodels.Received; CLTeams.Sent = eappsmodels.Sent; CLTeams.Subject = eappsmodels.Subject; CLTeams.UserAssigned = eappsmodels.UserAssigned; // add data to database db.CLTeams.Add(CLTeams); db.SaveChanges(); // find the old record and remove EAppsModels eapp = db.EApps.Find(eappsmodels.ID); db.EApps.Remove(eapp); db.SaveChanges(); return RedirectToAction("Index"); } else { db.Entry(eappsmodels).State = EntityState.Modified; db.SaveChanges(); return RedirectToAction("Index"); } } return View(eappsmodels); }