Пример #1
0
        public ActionResult Edit(int?id, authortable author)
        {
            try
            {
                using (aptadbEntities aptadb = new aptadbEntities())
                {
                    //return View(aptadb.authortable.Where(x => x.authorid == id).FirstOrDefault());
                    aptadb.Entry(author).State = EntityState.Modified;
                    aptadb.SaveChanges();
                }

                return(RedirectToAction("Index"));
            }
            catch
            {
                return(View());
            }
        }
Пример #2
0
        public ActionResult Edit(int?id, reservationtable reserv)
        {
            try
            {
                // TODO: Add update logic here
                using (aptadbEntities aptadb = new aptadbEntities())
                {
                    //return View(aptadb.authortable.Where(x => x.authorid == id).FirstOrDefault());
                    aptadb.Entry(reserv).State = EntityState.Modified;
                    aptadb.SaveChanges();
                }

                return(RedirectToAction("Index"));
            }
            catch
            {
                return(View());
            }
        }
Пример #3
0
        public ActionResult Create(reservationtable reserve)
        {
            try
            {
                // TODO: Add insert logic here
                using (aptadbEntities aptadb = new aptadbEntities())
                {
                    aptadb.reservationtable.Add(reserve);
                    aptadb.SaveChanges();
                    //return View(aptadb.authortable.ToList());
                }

                return(RedirectToAction("Index"));
            }
            catch
            {
                return(View());
            }
        }
Пример #4
0
        public ActionResult Delete(int?id, FormCollection collection)
        {
            try
            {
                // TODO: Add delete logic here
                using (aptadbEntities aptadb = new aptadbEntities())
                {
                    //aptadb.authortable.Add(author);
                    reservationtable resable = aptadb.reservationtable.Where(x => x.reservationID == id).FirstOrDefault();
                    aptadb.reservationtable.Remove(resable);
                    aptadb.SaveChanges();
                    //return View(aptadb.authortable.ToList());
                }

                return(RedirectToAction("Index"));
            }
            catch
            {
                return(View());
            }
        }