public ActionResult DeleteConfirmed(int id)
        {
            if (!Check_Admin())
            {
                return(RedirectToAction("Index", "Login"));
            }
            Leave_type leave_type = db.Leave_type.Find(id);

            db.Leave_type.Remove(leave_type);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
 public ActionResult Edit([Bind(Include = "id,type_name")] Leave_type leave_type)
 {
     if (!Check_Admin())
     {
         return(RedirectToAction("Index", "Login"));
     }
     if (ModelState.IsValid)
     {
         db.Entry(leave_type).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(leave_type));
 }
        public ActionResult Create([Bind(Include = "id,type_name")] Leave_type leave_type)
        {
            if (!Check_Admin())
            {
                return(RedirectToAction("Index", "Login"));
            }
            if (ModelState.IsValid)
            {
                db.Leave_type.Add(leave_type);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(leave_type));
        }
        // GET: Leave_type/Edit/5
        public ActionResult Edit(int?id)
        {
            if (!Check_Admin())
            {
                return(RedirectToAction("Index", "Login"));
            }
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Leave_type leave_type = db.Leave_type.Find(id);

            if (leave_type == null)
            {
                return(HttpNotFound());
            }
            return(View(leave_type));
        }