예제 #1
0
        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;
            }
        }
예제 #2
0
        public ActionResult DeleteConfirmed(int id)
        {
            InterestGroup interestGroup = db.InterestGroups.Find(id);

            db.InterestGroups.Remove(interestGroup);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
예제 #3
0
 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));
 }
예제 #4
0
        public ActionResult Create([Bind(Include = "InterestGroupID,Name")] InterestGroup interestGroup)
        {
            if (ModelState.IsValid)
            {
                db.InterestGroups.Add(interestGroup);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(interestGroup));
        }
예제 #5
0
        // 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));
        }