Beispiel #1
0
 public Vote(User user, Survey survey, Answer answer)
     : this()
 {
     this.User = user;
     this.Survey = survey;
     this.Answer = answer;
 }
Beispiel #2
0
 public static User GenerateNewUser()
 {
     User u = new User();
     var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
     random = new Random();
     u.Code = new string(
         Enumerable.Repeat(chars, 30)
                   .Select(s => s[random.Next(s.Length)])
                   .ToArray());
     u.Created = DateTime.Now;
     return u;
 }
Beispiel #3
0
		public async Task AuthenticateWithBackend() {
			if (IsAuthenticated) {
				return;
				//throw new Exception ("User is already authenticated with backend");
			}

			User user = await Backend.CreateNewUserAsync();
			Application.Current.Properties ["UserAsString"] = JsonConvert.SerializeObject(user);
			Application.Current.SavePropertiesAsync();
			User = user;
			IsAuthenticated = true;
		}
Beispiel #4
0
		public Panic(string course, User user) {
			this.Course = course;
			this.User = user;
			this.Created = DateTime.Now;
		}
Beispiel #5
0
 public UserResponse(User user, string e)
 {
     this.User = user;
     this.ExceptionMessage = e;
 }
Beispiel #6
0
 public void SaveUser(User user)
 {
     if (user.Id == 0)
     {
         this.Users.Add(user);
     }
     else
     {
         this.Users.Attach(user);
     }
     this.SaveChanges();
 }
Beispiel #7
0
 public Vote GetVoteForUser(Survey survey, User user)
 {
     var query = this.Votes
         .Include(v => v.Answer).Include(v => v.Survey).Include(v => v.User)
         .Where(v => v.Survey.Id == survey.Id && v.User.Id == user.Id);
     if (query.Count() > 1)
     {
         this.Log(string.Format("User {0} has voted multiple times for survey {1}", user.Id, survey.Id));
     }
     return query.FirstOrDefault<Vote>();
 }
Beispiel #8
0
 public GetVoteForUserRequest(Survey survey, User user)
 {
     this.Survey = survey;
     this.User = user;
 }