コード例 #1
0
ファイル: authorController.cs プロジェクト: chandan26/FL
        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
ファイル: reservationController.cs プロジェクト: chandan26/FL
        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
ファイル: reservationController.cs プロジェクト: chandan26/FL
        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
ファイル: reservationController.cs プロジェクト: chandan26/FL
        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());
            }
        }