public Guid UpsertInterestGroup(InterestGroup group) { try { if (group.Id == Guid.Empty) { // Insert new record group.DateCreated = DateTime.UtcNow; _unitOfWork.EIGRepo.Add(group); } else { group.DateModified = DateTime.UtcNow; _unitOfWork.EIGRepo.Update(group); } _unitOfWork.Commit(); return(group.Id); } catch (Exception ex) { // TODO: Log error throw ex; } }
public ActionResult DeleteConfirmed(int id) { InterestGroup interestGroup = db.InterestGroups.Find(id); db.InterestGroups.Remove(interestGroup); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "InterestGroupID,Name")] InterestGroup interestGroup) { if (ModelState.IsValid) { db.Entry(interestGroup).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(interestGroup)); }
public ActionResult Create([Bind(Include = "InterestGroupID,Name")] InterestGroup interestGroup) { if (ModelState.IsValid) { db.InterestGroups.Add(interestGroup); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(interestGroup)); }
// GET: InterestGroups/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } InterestGroup interestGroup = db.InterestGroups.Find(id); if (interestGroup == null) { return(HttpNotFound()); } return(View(interestGroup)); }