コード例 #1
0
        public ActionResult Edit(int empId)
        {
            // logic to count user actions
            var userName = Session["userName"] as string;

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

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