Exemplo n.º 1
0
        public static User GetCurrentUser()
        {
            var user = new User();

            using (var sql = new SampleTravelersContext())
            {
                var name = System.Security.Principal.WindowsIdentity.GetCurrent().Name;
                user = sql.Users.Where(x => x.WindowsName == name).First();
            }
            return(user);
        }
Exemplo n.º 2
0
 public Response GetLatestResponse(Question q)
 {
     using (var sql = new SampleTravelersContext())
     {
         var p = this.Questions.Where(x => x.Id == q.Id);
         if (p.Any())
         {
             if (p.First().GetMilestoneResponseForQuestion(this).Responses.Any())
             {
                 p.First().GetMilestoneResponseForQuestion(this).Responses.First();
             }
             else
             {
                 return(null);
             }
         }
         else
         {
             return(null);
         }
     }
     return(null);
 }