public ActionResult DeleteConfirmed(Guid id) { PublicationClassification publicationClassification = dbPubClass.PublicationClassification.Find(id); dbPubClass.PublicationClassification.Remove(publicationClassification); dbPubClass.SaveChanges(); return(RedirectToAction("Index")); }
// GET: PublicationClassifications/Edit/5 public ActionResult Edit(Guid?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } PublicationClassification publicationClassification = dbPubClass.PublicationClassification.Find(id); if (publicationClassification == null) { return(HttpNotFound()); } return(View(publicationClassification)); }
public ActionResult Edit([Bind(Include = "PublicationClassificationID,Name,Description")] PublicationClassificationViewModel publicationClassificationViewModel) { if (ModelState.IsValid) { PublicationClassification model = dbPubClass.PublicationClassification.Find(publicationClassificationViewModel.PublicationClassificationID); model.Name = publicationClassificationViewModel.Name; model.Description = publicationClassificationViewModel.Description; model.DateModified = DateTime.Now; model.UserModifiedID = Guid.Parse(User.Identity.GetUserId()); dbPubClass.Entry(model).State = EntityState.Modified; dbPubClass.SaveChanges(); return(RedirectToAction("Index")); } return(View(publicationClassificationViewModel)); }
public ActionResult Create([Bind(Include = "Name,Description")] PublicationClassification publicationClassification) { if (ModelState.IsValid) { publicationClassification.PublicationClassificationID = Guid.NewGuid(); publicationClassification.DateCreated = DateTime.Now; publicationClassification.DateModified = publicationClassification.DateCreated; publicationClassification.UserCreatedID = Guid.Parse(User.Identity.GetUserId()); publicationClassification.UserModifiedID = publicationClassification.UserCreatedID; dbPubClass.PublicationClassification.Add(publicationClassification); dbPubClass.SaveChanges(); return(RedirectToAction("Index")); } return(View(publicationClassification)); }