// GET: ManagerEval public ActionResult Index(int user) { ViewBag.employename = ES.GetById(user).nom; IEnumerable <managereval> me = MS.GetMany(p => p.employe_id == user); foreach (var m in me) { m.critere = CS.GetById(m.critere_id); } ViewBag.result = me; if (MS.GetMany(p => p.employe_id == user).Count() != 0) { ViewBag.moy = MS.GetMany(p => p.employe_id == user).Select(f => f.value).Average(); double avg = (double)MS.GetMany(p => p.employe_id == user).Select(f => f.value).Average(); int avg2 = Convert.ToInt32(avg); ViewBag.moy2 = avg2; } else { ViewBag.moy = 0; ViewBag.moy2 = 0; } return(View(ViewBag)); }
public ActionResult UpdateAccount(int id) { using (WakilRecouvContext WakilContext = new WakilRecouvContext()) { using (UnitOfWork UOW = new UnitOfWork(WakilContext)) { EmployeService EmpService = new EmployeService(UOW); RoleService RoleService = new RoleService(UOW); var Roles = RoleService.GetAll(); ViewBag.RoleList = new SelectList(Roles, "RoleId", "role"); return(View(EmpService.GetById(id))); } } }
public ActionResult UpdateAccount(int id, Employe e) { using (WakilRecouvContext WakilContext = new WakilRecouvContext()) { using (UnitOfWork UOW = new UnitOfWork(WakilContext)) { EmployeService EmpService = new EmployeService(UOW); RoleService RoleService = new RoleService(UOW); var Roles = RoleService.GetAll(); ViewBag.RoleList = new SelectList(Roles, "RoleId", "role"); Employe emp = EmpService.GetById(id); emp.RoleId = e.RoleId; emp.IsVerified = e.IsVerified; emp.ConfirmPassword = emp.Password; EmpService.Update(emp); EmpService.Commit(); return(View("AccountList", EmpService.GetAll())); } } }