public void PopulateData(int projectId)
 {
     using (PersonDao context = new PersonDao()) {
         ProjectId = projectId;
         Assignments = context.db.ProjectAssignments.Where(x => x.ProjectId == projectId).Select(x => new AssignmentModel() { Id=x.Id, ProjectId=projectId, PersonId=x.PersonId, PersonUsername=x.Person.Username }).ToList();
         AllPersons = context.GetAll<Person>().Select(x => new PersonModel() { Id = x.Id, FirstName = x.FirstName, LastName = x.LastName, Username = x.Username }).ToList();
     }
 }
Ejemplo n.º 2
0
        internal void AuthenticateUser(HttpSessionStateBase Session,  ModelStateDictionary modelState)
        {
            using (PersonDao context = new PersonDao()) {
                if (!context.IsUserExisting(this.Username, this.Password)) {
                    modelState.AddModelError("UserNotExisting", "User does not exist");
                    return;
                }

                Person personEntity = context.GetUserFromAuth(this.Username, this.Password);
                Session["UserId"] = personEntity.Id;
                FormsAuthentication.SetAuthCookie(personEntity.Username, true);
            }
        }