public VoteResponse GetVoteForUser(GetVoteForUserRequest req) { Vote vote = null; string error = null; try { if (req.Survey == null || req.User == null) { throw new ArgumentNullException(); } using (var db = new SurveyContext()) { db.Configuration.LazyLoadingEnabled = false; db.Configuration.ProxyCreationEnabled = false; vote = db.GetVoteForUser(req.Survey, req.User); } } catch (Exception e) { error = e.Message; } return(new VoteResponse(vote, error)); }
public VoteResponse GetVoteForUser(GetVoteForUserRequest req) { Vote vote = null; string error = null; try { if (req.Survey == null || req.User == null) { throw new ArgumentNullException(); } using (var db = new SurveyContext()) { db.Configuration.LazyLoadingEnabled = false; db.Configuration.ProxyCreationEnabled = false; vote = db.GetVoteForUser(req.Survey, req.User); } } catch (Exception e) { error = e.Message; } return new VoteResponse(vote, error); }