public ActionResult Create(EOS_Interview_Questions_Groups model) { try { if (ModelState.IsValid) { EOS_Interview_Questions_Groups record = new EOS_Interview_Questions_Groups(); record.Questions_Group_Code = model.Questions_Group_Code; record.Description_Alternative = model.Description_Alternative; record.Description_of = model.Description_of; dbcontext.EOS_Interview_Questions_Groups.Add(record); dbcontext.SaveChanges(); return(RedirectToAction("Index")); } else { return(View(model)); } } catch (DbUpdateException) { TempData["Message"] = HR.Resource.Basic.thiscodeIsalreadyexists; return(View(model)); } catch (Exception e) { return(View(model)); } }
public ActionResult Edit(EOS_Interview_Questions_Groups model) { try { var record = dbcontext.EOS_Interview_Questions_Groups.FirstOrDefault(m => m.ID == model.ID); record.Questions_Group_Code = model.Questions_Group_Code; record.Description_Alternative = model.Description_Alternative; record.Description_of = model.Description_of; dbcontext.SaveChanges(); return(RedirectToAction("index")); } catch (DbUpdateException) { TempData["Message"] = HR.Resource.Basic.thiscodeIsalreadyexists; return(View(model)); } catch (Exception e) { return(View(model)); } }
public ActionResult Create() { var stru = dbcontext.StructureModels.FirstOrDefault(m => m.All_Models == ChModels.Personnel); var model = dbcontext.EOS_Interview_Questions_Groups.ToList(); var count = 0; if (model.Count() == 0) { count = 1; } else { var te = model.LastOrDefault().ID; count = te + 1; } var modell = new EOS_Interview_Questions_Groups { Questions_Group_Code = stru.Structure_Code + count }; return(View(modell)); }