// GET: DictDaysOffs/Edit/5
        public ActionResult Edit(int?id)
        {
            if (Roles.IsUserInRole(User.Identity.Name, "User"))
            {
                return(RedirectToAction("Index", "Home"));
            }
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            DictDaysOff dictDaysOff = db.DictDaysOffs.Find(id);

            if (dictDaysOff == null)
            {
                return(HttpNotFound());
            }

            if (!Roles.IsUserInRole(User.Identity.Name, "Admin"))
            {
                ViewBag.Message = @"<div class=""alert alert-danger"" role=""alert"">No permission for the requested action.</div>";
                return(View("Index", db.DictDaysOffs.Include(d => d.DictDepartment).ToList()));
            }

            ViewBag.DictDepartmentID = new SelectList(db.DictDepartments, "DictDepartmentID", "Name", dictDaysOff.DictDepartmentID);
            return(View(dictDaysOff));
        }
        // GET: DictDaysOffs/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            DictDaysOff dictDaysOff = db.DictDaysOffs.Find(id);

            if (dictDaysOff == null)
            {
                return(HttpNotFound());
            }
            return(View(dictDaysOff));
        }
 public ActionResult Edit([Bind(Include = "DictDaysOffId,DictDepartmentID,DateDayOff")] DictDaysOff dictDaysOff)
 {
     if (ModelState.IsValid)
     {
         try
         {
             db.Entry(dictDaysOff).State = EntityState.Modified;
             db.SaveChanges();
             return(RedirectToAction("Index"));
         }
         catch (RetryLimitExceededException /* dex */)
         {
             //Log the error (uncomment dex variable name and add a line here to write a log.)
             ModelState.AddModelError("", "Unable to save changes. Try again, and if the problem persists, see your system administrator.");
         }
     }
     ViewBag.DictDepartmentID = new SelectList(db.DictDepartments, "DictDepartmentID", "Name", dictDaysOff.DictDepartmentID);
     return(View(dictDaysOff));
 }