Exemplo n.º 1
0
        public virtual ActionResult editHoliday(Holidays holiday)
        {
            Authentication auth = new Authentication();

            if (auth.isAdmin(this) || Authentication.DEBUG_bypassAuth)
            {
                HolidaysDB.Entry(holiday).State = System.Data.EntityState.Modified;
                HolidaysDB.SaveChanges();
                return(RedirectToAction("viewHolidays"));
            }
            else
            {
                return(View("error"));
            }
        }
Exemplo n.º 2
0
        public virtual ActionResult addHoliday(Holidays holiday)
        {
            Authentication auth = new Authentication();

            if (auth.isAdmin(this) || Authentication.DEBUG_bypassAuth)
            {
                HolidaysDB.HolidaysList.Add(holiday);
                HolidaysDB.SaveChanges();
                return(RedirectToAction("viewHolidays"));
            }
            else
            {
                return(View("error"));
            }
        }
Exemplo n.º 3
0
        [HttpPost, ActionName("deleteHoliday")] //This action MUST match the above delete function.
        public virtual ActionResult confirmDeleteHoliday(int id)
        {
            Authentication auth = new Authentication();

            if (auth.isAdmin(this) || Authentication.DEBUG_bypassAuth)
            {
                Holidays holiday = HolidaysDB.HolidaysList.Find(id);
                HolidaysDB.HolidaysList.Remove(holiday);
                HolidaysDB.SaveChanges();
                return(RedirectToAction("viewHolidays"));
            }
            else
            {
                return(View("error"));
            }
        }