Exemplo n.º 1
0
        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));
        }
Exemplo n.º 2
0
 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);
 }