Пример #1
0
        public ActionResult Delete(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);
                if (model == null)
                {
                    return(View("NotFound"));
                }
                ViewBag.ManagerName = employeeBL.GetEmployeeName((int)model.Manager);
                return(View(model));
            }
        }
Пример #2
0
        public ActionResult AddShift(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
            {
                ViewBag.employeeName = employeeBL.GetEmployeeName(empId);
                ViewBag.empId        = empId;
                ViewBag.shifts       = shiftBL.GetAll();
                return(View());
            }
        }