예제 #1
0
        public ActionResult Create(papertable paper)
        {
            try
            {
                // TODO: Add insert logic here
                using (aptadbEntities aptadb = new aptadbEntities())
                {
                    aptadb.papertable.Add(paper);
                    aptadb.SaveChanges();
                    //return View(aptadb.authortable.ToList());
                }

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

                return(RedirectToAction("Index"));
            }
            catch
            {
                return(View());
            }
        }
예제 #3
0
        public ActionResult Delete(int id, FormCollection collection)
        {
            try
            {
                // TODO: Add delete logic here
                using (aptadbEntities aptadb = new aptadbEntities())
                {
                    //aptadb.authortable.Add(author);
                    papertable ppertable = aptadb.papertable.Where(x => x.paperid == id).FirstOrDefault();
                    aptadb.papertable.Remove(ppertable);
                    aptadb.SaveChanges();
                    //return View(aptadb.authortable.ToList());
                }

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