예제 #1
0
        public ActionResult Edit(int depId)
        {
            var userName = Session["userName"] as string;

            loginBL.UpdateActionCounter(userName);
            var amountActions = loginBL.GetUpdateActionsForUser(userName);

            Session["AmountOfActions"] = amountActions;
            if (amountActions < 0)
            {
                Session.Clear();
                TempData["ErrorMessage"] = "Logout out by the system! user doesn't have actions";
                return(RedirectToAction("Index", "Login"));
            }
            else
            {
                var model = departmentBL.GetById(depId);
                ViewBag.employees = employeeBL.GetEmployees();
                if (model == null)
                {
                    return(View("NotFound"));
                }
                return(View(model));
            }
        }