public ActionResult CommCreate(CommHeaders commHeaders) { commHeaders.DistKey = GlobalVariables.DistKey; string positionTitle = db.Positions.FirstOrDefault(x => x.pKey == commHeaders.PositionKey).CommitteeTitle; commHeaders.CommName = positionTitle; db.CommHeaders.Add(commHeaders); db.SaveChanges(); return RedirectToAction("CommIndex"); }
public ActionResult CommEdit(CommHeaders commHeaders) { if (ModelState.IsValid) { commHeaders.DistKey = GlobalVariables.DistKey; //string positionTitle = db.Positions.FirstOrDefault(x => x.pKey == commHeaders.PositionKey).CommitteeTitle; //commHeaders.CommName = positionTitle; db.Entry(commHeaders).State = EntityState.Modified; db.SaveChanges(); return RedirectToAction("CommIndex"); } return View(commHeaders); }