Example #1
0
 public void Add(CategoryDebate categoryDebate)
 {
     try
     {
         using (var context = new dezbateriEntities())
         {
             context.CategoryDebates.Add(categoryDebate);
             context.SaveChanges();
         }
     }
     catch (Exception ex)
     {
         throw new CategoryDebateException("Add", ex);
     }
 }
Example #2
0
 public void Update(CategoryDebate categoryDebate)
 {
     try
     {
         using (var context = new dezbateriEntities())
         {
             var categoryDebateUpdated = context.CategoryDebates.FirstOrDefault(categoryDebateObj => categoryDebateObj.debate_id == categoryDebate.debate_id);
             if (categoryDebateUpdated == null)
             {
                 throw new CategoryDebateException("No categoryDebate found");
             }
             categoryDebateUpdated.category_id = categoryDebate.category_id;
             context.SaveChanges();
         }
     }
     catch (Exception ex)
     {
         throw new CategoryDebateException("Update", ex);
     }
 }