Ejemplo n.º 1
0
        public ActionResult DeleteConfirmed(int id)
        {
            p_author p_author = db.p_author.Find(id);

            db.p_author.Remove(p_author);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Ejemplo n.º 2
0
 public ActionResult Edit([Bind(Include = "C_id,lname,fname,email")] p_author p_author)
 {
     if (ModelState.IsValid)
     {
         db.Entry(p_author).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(p_author));
 }
Ejemplo n.º 3
0
 public ActionResult Create([Bind(Include = "C_id,lname,fname,email")] p_author p_author)
 {
     if (ModelState.IsValid && !db.p_author.Where(item => item.fname == p_author.fname && item.lname == p_author.lname).Any())
     {
         db.p_author.Add(p_author);
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.ErrorMessage = "This user already exists";
     return(View(p_author));
 }
Ejemplo n.º 4
0
        // GET: p_author/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            p_author p_author = db.p_author.Find(id);

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