public ActionResult AdaugaAngajat() { var context = new AddAngajatViewModel(); context.Init(_functie, _angajatRepository, _utilajRepository, (int)Session["Id"]); return(View(context)); }
public ActionResult AddFunctie(AddAngajatViewModel func) { var item = func.Functi; item.IdFirma = (int)Session["Id"]; if (ModelState.IsValid) { var finde = Context.Functie.Where(e => e.Denumire == item.Denumire).SingleOrDefault(); if (finde == null) { _functie.Add(item); TempData["check"] = "Functia sa adaugat cu succes"; return(RedirectToAction("ShowAngajati", "OperationAngajat", new { id = Session["Id"] })); } ModelState.AddModelError("Functi.Denumire", "Aceasta functie exista in baza de date"); } return(View()); }