public IActionResult CarEdit(TPCareer career, string actionType) { int?Pid = career.CarePerId; if (actionType == "Update") { if (ModelState.IsValid) { try{ _dbContext.TPCareers.Update(career); _dbContext.SaveChanges(); } catch {} } else { loadPersonViewBag(Pid); return(View(career)); } } var model = _dbContext.TPersons .SingleOrDefault(u => u.PerId.Equals(Pid)); CreateViewBags(Pid); ViewData["panel"] = 2; return(View("Edit", model)); }
public IActionResult CarEdit(TPCareer career, string actionType) { int?Pid = career.CarePerId; if (actionType == "Update") { if (ModelState.IsValid) { try{ _dbContext.TPCareers.Update(career); _dbContext.SaveChanges(); } catch {} } else { loadPersonViewBag(Pid); return(View(career)); } } var model = _dbContext.TPersons .SingleOrDefault(u => u.PerId.Equals(Pid)); string dName = model.PerName1 + " " + model.PerName; ViewData["dName"] = dName; ViewData["PerId"] = Pid; CreateViewBags(Pid); ViewData["panel"] = 2; return(RedirectToAction("Edit", new { id = Pid, panel = 2, move = 0 })); }