public void Update(Argument argument) { Boolean check = false; try { using (var context = new dezbateriEntities()) { var argumentUpdated = context.Arguments.FirstOrDefault(argumentObj => argumentObj.Id == argument.Id); if (argumentUpdated == null) { check = true; } argumentUpdated.Side = argument.Side; argumentUpdated.Date_created = argument.Date_created; argumentUpdated.Content = argument.Content; context.SaveChanges(); } } catch (Exception ex) { throw new Exception("815", ex); } finally { if (check) { throw new Exception("813"); } } }
public void Update(User user) { Boolean check = false; try { using (var context = new dezbateriEntities()) { var userUpdated = context.Users.FirstOrDefault(userObj => userObj.Email == user.Email); if (userUpdated == null) { check = true; } userUpdated.Birthdate = user.Birthdate; userUpdated.Password = user.Password; userUpdated.Type = user.Type; userUpdated.Username = user.Username; context.SaveChanges(); } } catch (Exception ex) { throw new UserException("805", ex); } finally { if (check) { throw new UserException("803"); } } }
public void Update(Opinion opinion) { Boolean check = false; try { using (var context = new dezbateriEntities()) { var opinionUpdated = context.Opinions.FirstOrDefault(opinionObj => opinionObj.Id == opinion.Id); if (opinionUpdated == null) { check = true; } opinionUpdated.Subject = opinion.Subject; opinionUpdated.Date_created = opinion.Date_created; opinionUpdated.User_email = opinion.User_email; opinionUpdated.Picture_url = opinion.Picture_url; context.SaveChanges(); } } catch (Exception ex) { throw new Exception("815", ex); } finally { if (check) { throw new Exception("813"); } } }
public void Delete(int opinionVoteId) { Boolean check = false; try { using (var context = new dezbateriEntities()) { var deleteOpinionVote = context.OpinionVotes.FirstOrDefault(opinionVote => opinionVote.Id == opinionVoteId); if (deleteOpinionVote == null) { check = true; } context.OpinionVotes.Remove(deleteOpinionVote); context.SaveChanges(); } } catch (Exception ex) { throw new Exception("816", ex); } finally { if (check) { throw new Exception("813"); } } }
public void Update(Content content) { try { using (var context = new dezbateriEntities()) { var contentUpdated = context.Contents.FirstOrDefault(contentObj => contentObj.debate_id == content.debate_id); if (contentUpdated == null) { throw new ContentException("No content found"); } contentUpdated.round_1 = content.round_1; contentUpdated.round_2 = content.round_2; contentUpdated.round_3 = content.round_3; contentUpdated.round_4 = content.round_4; contentUpdated.round_5 = content.round_5; contentUpdated.round_6 = content.round_6; context.SaveChanges(); } } catch (Exception ex) { throw new ContentException("Update", ex); } }
public void Delete(int argumentId) { Boolean check = false; try { using (var context = new dezbateriEntities()) { var deleteArgument = context.Arguments.FirstOrDefault(argument => argument.Id == argumentId); if (deleteArgument == null) { check = true; } context.Arguments.Remove(deleteArgument); context.SaveChanges(); } } catch (Exception ex) { throw new Exception("816", ex); } finally { if (check) { throw new Exception("813"); } } }
public void Update(OpinionVote opinionVote) { Boolean check = false; try { using (var context = new dezbateriEntities()) { var opinionVoteUpdated = context.OpinionVotes.FirstOrDefault(opinionVoteObj => opinionVoteObj.Id == opinionVote.Id); if (opinionVoteUpdated == null) { check = true; } opinionVoteUpdated.Vote_pro = opinionVote.Vote_pro; context.SaveChanges(); } } catch (Exception ex) { throw new Exception("815", ex); } finally { if (check) { throw new Exception("813"); } } }
public void Delete(int categoryId) { Boolean check = false; try { using (var context = new dezbateriEntities()) { var deleteCategory = context.Categories.FirstOrDefault(category => category.id == categoryId); if (deleteCategory == null) { check = true; } context.Categories.Remove(deleteCategory); context.SaveChanges(); } } catch (Exception ex) { throw new CategoryException("816", ex); } finally { if (check) { throw new UserException("813"); } } }
public void Delete(string userEmail) { Boolean check = false; try { using (var context = new dezbateriEntities()) { var deleteUser = context.Users.FirstOrDefault(user => user.Email == userEmail); if (deleteUser == null) { check = true; } context.Users.Remove(deleteUser); context.SaveChanges(); } } catch (Exception ex) { throw new UserException("806", ex); } finally { if (check) { throw new UserException("803"); } } }
public void Update(Category category) { Boolean check = false; try { using (var context = new dezbateriEntities()) { var categoryUpdated = context.Categories.FirstOrDefault(categoryObj => categoryObj.id == category.id); if (categoryUpdated == null) { check = true; } categoryUpdated.name = category.name; context.SaveChanges(); } } catch (Exception ex) { throw new CategoryException("815", ex); } finally { if (check) { throw new UserException("813"); } } }
public void Update(CategoryOpinion categoryOpinion) { Boolean check = false; try { using (var context = new dezbateriEntities()) { var categoryOpinionUpdated = context.CategoryOpinions.FirstOrDefault(categoryOpinionObj => categoryOpinionObj.Id == categoryOpinion.Id); if (categoryOpinionUpdated == null) { check = true; } categoryOpinionUpdated.Categ_id = categoryOpinion.Categ_id; categoryOpinionUpdated.Opinion_id = categoryOpinion.Opinion_id; context.SaveChanges(); } } catch (Exception ex) { throw new Exception("815", ex); } finally { if (check) { throw new Exception("813"); } } }
public void Add(User user) { try { using (var context = new dezbateriEntities()) { context.Users.Add(user); context.SaveChanges(); } } catch (Exception ex) { throw new UserException("800", ex); } }
public void Add(RoundState roundState) { try { using (var context = new dezbateriEntities()) { context.RoundStates.Add(roundState); context.SaveChanges(); } } catch (Exception ex) { throw new RoundStateException("Add", ex); } }
public void Add(Vote vote) { try { using (var context = new dezbateriEntities()) { context.Votes.Add(vote); context.SaveChanges(); } } catch (Exception ex) { throw new VoteException("Add", ex); } }
public void Add(Argument argument) { try { using (var context = new dezbateriEntities()) { context.Arguments.Add(argument); context.SaveChanges(); } } catch (Exception ex) { throw new Exception("810", ex); } }
public void Add(CategoryOpinion categoryOpinion) { try { using (var context = new dezbateriEntities()) { context.CategoryOpinions.Add(categoryOpinion); context.SaveChanges(); } } catch (Exception ex) { throw new Exception("810", ex); } }
public void Add(UserDebate userDebate) { try { using (var context = new dezbateriEntities()) { context.UserDebates.Add(userDebate); context.SaveChanges(); } } catch (Exception ex) { throw new UserDebateException("Add", ex); } }
public void Delete(int categoryDebateId) { try { using (var context = new dezbateriEntities()) { context.CategoryDebates.RemoveRange(context.CategoryDebates.Where(categoryDebate => categoryDebate.debate_id == categoryDebateId)); context.SaveChanges(); } } catch (Exception ex) { throw new CategoryDebateException("Delete", ex); } }
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); } }
public void Add(Content content) { try { using (var context = new dezbateriEntities()) { context.Contents.Add(content); context.SaveChanges(); } } catch (Exception ex) { throw new ContentException("Add", ex); } }
public Commentary Add(Commentary Commentary) { try { using (var context = new dezbateriEntities()) { Commentary comm = context.Commentaries.Add(Commentary); context.SaveChanges(); return(comm); } } catch (Exception ex) { throw new CommentaryException("Add", ex); } }
public UserVerification Add(UserVerification UserVerification) { try { using (var context = new dezbateriEntities()) { UserVerification comm = context.UserVerifications.Add(UserVerification); context.SaveChanges(); return(comm); } } catch (Exception ex) { throw new UserVerificationException("Add", ex); } }
public OpinionVote Add(OpinionVote opinionVote) { try { using (var context = new dezbateriEntities()) { OpinionVote op = context.OpinionVotes.Add(opinionVote); context.SaveChanges(); return(op); } } catch (Exception ex) { throw new Exception("810", ex); } }
public dynamic Add(DebateInfo debate) { try { using (var context = new dezbateriEntities()) { var addedDebate = context.DebateInfoes.Add(debate); context.SaveChanges(); return(addedDebate); } } catch (Exception ex) { throw new DebateException("Add", ex); } }
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); } }
public void Delete(string email) { try { using (var context = new dezbateriEntities()) { var deleteUserVerification = context.UserVerifications.FirstOrDefault(UserVerification => UserVerification.UserEmail == email); if (deleteUserVerification == null) { throw new UserVerificationException("UserVerification not found to delete"); } context.UserVerifications.Remove(deleteUserVerification); context.SaveChanges(); } } catch (Exception ex) { throw new UserVerificationException("Delete", ex); } }
public void Delete(int contentId) { try { using (var context = new dezbateriEntities()) { var deleteContent = context.Contents.FirstOrDefault(content => content.debate_id == contentId); if (deleteContent == null) { throw new ContentException("Content not found to delete"); } context.Contents.Remove(deleteContent); context.SaveChanges(); } } catch (Exception ex) { throw new ContentException("Delete", ex); } }
public void Delete(int debateId) { try { using (var context = new dezbateriEntities()) { var deleteDebate = context.DebateInfoes.FirstOrDefault(debate => debate.debate_id == debateId); if (deleteDebate == null) { throw new DebateException("Debate not found to delete"); } context.DebateInfoes.Remove(deleteDebate); context.SaveChanges(); } } catch (Exception ex) { throw new DebateException("Delete", ex); } }
public void Delete(int CommentaryId) { try { using (var context = new dezbateriEntities()) { var deleteCommentary = context.Commentaries.FirstOrDefault(Commentary => Commentary.Id == CommentaryId); if (deleteCommentary == null) { throw new CommentaryException("Commentary not found to delete"); } context.Commentaries.Remove(deleteCommentary); context.SaveChanges(); } } catch (Exception ex) { throw new CommentaryException("Delete", ex); } }
public void Update(RoundState roundState) { try { using (var context = new dezbateriEntities()) { var roundStateUpdated = context.RoundStates.FirstOrDefault(roundStateObj => roundStateObj.debate_id == roundState.debate_id); if (roundStateUpdated == null) { throw new RoundStateException("No roundState found"); } roundStateUpdated.next_round = roundState.next_round; roundStateUpdated.time_to_next = roundState.time_to_next; context.SaveChanges(); } } catch (Exception ex) { throw new RoundStateException("Update", ex); } }