<br /> <br /> public ActionResult Create()<br /> {<br /> return View();<br /> }<br /> <br /> // POST: authors/Create<br /> // To protect from overposting attacks, please enable the specific properties you want to bind to, for <br /> // more details see http://go.microsoft.com/fwlink/?LinkId=317598.<br /> [HttpPost]<br /> [ValidateAntiForgeryToken]<br /> public ActionResult Create([Bind(Include = "au_id,au_lname,au_fname,phone,address,city,state,zip,contract")] author author)<br /> {<br /> if (ModelState.IsValid)<br /> {<br /> db.authors.Add(author);<br /> db.SaveChanges();<br /> return RedirectToAction("Index");<br /> }<br /> <br /> return View(author);<br /> }<br /> <br />
<br /> <br /> public ActionResult Delete(string id)<br /> {<br /> if (id == null)<br /> {<br /> return new HttpStatusCodeResult(HttpStatusCode.BadRequest);<br /> }<br /> author author = db.authors.Find(id);<br /> if (author == null)<br /> {<br /> return HttpNotFound();<br /> }<br /> return View(author);<br /> }<br /> <br /> // POST: authors/Delete/5<br /> [HttpPost, ActionName("Delete")]<br /> [ValidateAntiForgeryToken]<br /> public ActionResult DeleteConfirmed(string id)<br /> {<br /> author author = db.authors.Find(id);<br /> db.authors.Remove(author);<br /> db.SaveChanges();<br /> return RedirectToAction("Index");<br /> }<br /> <br />
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)