public Vote(User user, Survey survey, Answer answer) : this() { this.User = user; this.Survey = survey; this.Answer = answer; }
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; }
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; }
public Panic(string course, User user) { this.Course = course; this.User = user; this.Created = DateTime.Now; }
public UserResponse(User user, string e) { this.User = user; this.ExceptionMessage = e; }
public void SaveUser(User user) { if (user.Id == 0) { this.Users.Add(user); } else { this.Users.Attach(user); } this.SaveChanges(); }
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>(); }
public GetVoteForUserRequest(Survey survey, User user) { this.Survey = survey; this.User = user; }