Пример #1
0
        public ActionResult DeleteConfirmed(int id)
        {
            Holiday holiday = db.Holidays.Find(id);

            db.Holidays.Remove(holiday);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Пример #2
0
 public ActionResult Edit([Bind(Include = "Id,Name,Date")] Holiday holiday)
 {
     if (ModelState.IsValid)
     {
         db.Entry(holiday).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(holiday));
 }
Пример #3
0
        public ActionResult Create([Bind(Include = "Id,Name,Date")] Holiday holiday)
        {
            if (ModelState.IsValid)
            {
                db.Holidays.Add(holiday);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(holiday));
        }
Пример #4
0
        // GET: Holidays/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Holiday holiday = db.Holidays.Find(id);

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