示例#1
0
        public ActionResult Create(CreateMenteeView model)
        {
            //if (ModelState.IsValid)
            //{
            //Mentee mentee = new Mentee
            //{
            //    MenteeName = model.MenteeName,
            //    Age = model.Age,
            //    LevelId = model.Position
            //};
            // Настройка конфигурации AutoMapper
            var config = new MapperConfiguration(cfg => cfg.CreateMap <CreateMenteeView, Mentee>().
                                                 ForMember("LevelId", opt => opt.MapFrom(c => c.Position)));
            var mapper = new Mapper(config);
            // Выполняем сопоставление
            //var mentees = unitOfWork.Mentee.GetAll();
            Mentee mentee = mapper.Map <CreateMenteeView, Mentee>(model);

            //unitOfWork.Mentee.Create(mentee);

            // }
            unitOfWork.Mentee.Create(mentee);
            CreateMenteeView mView = new CreateMenteeView();

            mView = model.NewLevel();
            //mentee.MenteeId= unitOfWork.Mentee.GetAll().ToList().Last().MenteeId;
            //++mentee.MenteeId;
            //if (mentee.MenteeId > 0)
            //{
            unitOfWork.Save();
            return(RedirectToAction("Mentee"));

            // }
            return(View(mView));
        }
示例#2
0
        public MenteeModel AddMentee(MenteeModel model, int userId)
        {
            //Get category
            var query = from c in _context.Categories
                        where c.CategoryName == model.Category
                        select c;

            //Select first matching record
            var category = query.FirstOrDefault();

            //Get User from database
            var user = _context.Users.Find(userId);

            //Check if record is null
            if (user == null)
            {
                throw new Exception("This user doesnt exist");
            }

            var mentee = new Mentee
            {
                UserId   = user.UserId,
                Birthday = model.Birthday,
                Gender   = model.Gender,
                Address  = model.Address,
                MobileNo = model.MobileNo,
                Bio      = model.Bio,
                Category = category
            };

            _context.Mentees.Add(mentee);
            _context.SaveChanges();
            return(model);
        }
        public void FindUser_OneUser_Pass()
        {
            User fetchedUser = null;
            User stagedUser  = null;

            using (var context = new ApplicationDbContext(Options))
            {
                UserService service = new UserService(context);

                User u = new Mentee
                {
                    FirstName   = "Kyle",
                    LastName    = "Burgi",
                    Email       = "*****@*****.**",
                    PhoneNumber = "(123) 456-7890",
                    State       = "WA",
                    City        = "Spokane"
                };

                stagedUser = u;
                service.AddUser(u);
                fetchedUser = service.GetUser(1);
            }

            Assert.AreEqual(stagedUser, fetchedUser);
            Assert.AreEqual("Kyle", fetchedUser.FirstName);
            Assert.AreEqual("Burgi", fetchedUser.LastName);
            Assert.AreEqual(1, fetchedUser.Id);
        }
示例#4
0
        public async Task <IActionResult> Edit(int id, [Bind("MenteeId,LevelId,MenteeName,Age")] Mentee mentee)
        {
            if (id != mentee.MenteeId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(mentee);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!MenteeExists(mentee.MenteeId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["LevelId"] = new SelectList(_context.Set <Level>(), "LevelId", "LevelId", mentee.LevelId);
            return(View(mentee));
        }
        public void DeleteUser_Pass()
        {
            User u = new Mentee
            {
                FirstName   = "Kyle",
                LastName    = "Burgi",
                Email       = "*****@*****.**",
                PhoneNumber = "(123) 456-7890",
                State       = "WA",
                City        = "Spokane"
            };

            using (var context = new ApplicationDbContext(Options))
            {
                UserService service = new UserService(context);

                service.AddUser(u);
            }

            using (var context = new ApplicationDbContext(Options))
            {
                UserService service     = new UserService(context);
                bool        deletedUser = service.DeleteUser(1);
                Assert.IsTrue(deletedUser);
            }

            using (var context = new ApplicationDbContext(Options))
            {
                UserService service  = new UserService(context);
                User        nullUser = service.GetUser(2);
                Assert.IsNull(nullUser);
            }
        }
示例#6
0
        public Mentee NewMentee(Mentee mentee, int userId, int firstMentorId, int secondMentorId, string location, string seniority)
        {
            try
            {
                var user = _unitOfWork.UserRepository.Get(userId);

                var firstMentor  = _unitOfWork.MentorRepository.Get(firstMentorId);
                var secondMentor = _unitOfWork.MentorRepository.Get(secondMentorId);

                user.Roles.Add(_unitOfWork.UserRoleRepository.Get((int)UserRoleCode.Mentee));
                user.Location           = location;
                user.Seniority          = seniority;
                mentee.User             = user;
                mentee.FirstOption      = firstMentor;
                mentee.MentorOptionDate = DateTime.Now;
                mentee.SecondOption     = secondMentor;
                mentee.Status           = MenteeStatus.PendingApproval;

                _userLogService.Add(user.Id, UserLogAction.PendingApprovalMentee, string.Format(Resources.Messages.MenteePendingApproval, user.Name));

                _unitOfWork.MenteeRepository.Insert(mentee);
                _unitOfWork.Save();

                return(mentee);
            }
            catch (Exception ex)
            {
                _logManager.DefaultLogger.Error.Write("Mentoring.Application.MenteeService.NewMentee", ex);
                return(null);
            }
        }
示例#7
0
        public void AddMenteeFromForm(MenteeFormModel mentee)
        {
            //Todo - add entities to database based on the filled mentee form
            _db = new Mentor_MatchineEntities();
            var m = new Mentee();

            m.Age         = mentee.Age;
            m.Name        = mentee.Name;
            m.Surname     = mentee.Surname;
            m.ArrivalDate = DateTime.Parse(mentee.ArrivalDate);
            m.Disability  = Convert.ToByte(mentee.Disability);
            m.Gender      = mentee.Gender.ToString();
            m.Email       = mentee.Email;
            m.Phone       = mentee.Phone;
            m.HasMentor   = 0;
            //m.Nationality = mentee.Nationality; - pobrac nationality (mamy id z SelectList) i dodac do m nationalityId
            m.NationalityID = Int32.Parse(mentee.Nationality);

            var AutoID = GetNextMenteeID();

            menteeRepository.Add(m);

            foreach (string language in mentee.Languages)
            {
                var ml = new MenteeLanguage();
                //pobierac jakos prawidlowy kolejny id z bd
                ml.MenteeID = AutoID;
                System.Diagnostics.Debug.WriteLine(language.ToString());
                ml.LanguageID = Int32.Parse(language);
                menteeLanguagesRepository.Add(ml);
            }
        }
示例#8
0
        public ActionResult DeleteConfirmed(int id)
        {
            Mentee mentee = db.Mentee.Find(id);

            db.Mentee.Remove(mentee);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
示例#9
0
 public static MenteeDto FromMentee(Mentee mentee)
 => new MenteeDto
 {
     MenteeId     = mentee.MenteeId,
     FirstName    = mentee.FirstName,
     LastName     = mentee.LastName,
     EmailAddress = mentee.EmailAddress
 };
示例#10
0
        public BaseResponseDto ChangeStatus(string menteeId, bool status)
        {
            BaseResponseDto responseDto = null;
            Guid            guid        = new Guid(menteeId);

            if (menteeId.Equals(null))
            {
                responseDto = new BaseResponseDto
                {
                    Status  = 1,
                    Message = "Faulthy mentee Id."
                };
                return(responseDto);
            }

            Mentee existingMentee = _uow
                                    .GetRepository <Mentee>()
                                    .GetAll()
                                    .FirstOrDefault(m => m.MenteeId == guid);

            if (existingMentee == null)
            {
                responseDto = new BaseResponseDto
                {
                    Status  = 2,
                    Message = "Mentee with specified id not found"
                };
                return(responseDto);
            }

            try
            {
                existingMentee.IsDisable = status;
                _uow.GetRepository <Mentee>().Update(existingMentee);
                _uow.Commit();
            }
            catch (Exception e)
            {
                throw e;
            }

            responseDto = new BaseResponseDto
            {
                Status = 0
            };

            if (status == true)
            {
                responseDto.Message = "Mentee is disabled.";
            }
            else if (status == false)
            {
                responseDto.Message = "Mentee is enabled.";
            }

            return(responseDto);
        }
        public void UpdateUser_RequiredInfo_Pass()
        {
            User fetchedUser  = null;
            User fetchedUser2 = null;
            User secondFetch  = null;

            using (var context = new ApplicationDbContext(Options))
            {
                UserService service = new UserService(context);

                User u = new Mentee
                {
                    FirstName   = "Kyle",
                    LastName    = "Burgi",
                    Email       = "*****@*****.**",
                    PhoneNumber = "(123) 456-7890",
                    State       = "WA",
                    City        = "Spokane"
                };

                User u2 = new Mentee
                {
                    FirstName   = "Kyle2",
                    LastName    = "Burgi2",
                    Email       = "[email protected]",
                    PhoneNumber = "(123) 456-78902",
                    State       = "WA2",
                    City        = "Spokane2"
                };

                service.AddUser(u);
                service.AddUser(u2);

                fetchedUser  = service.GetUser(1);
                fetchedUser2 = service.GetUser(2);
            }

            fetchedUser.FirstName   = "Jess";
            fetchedUser.LastName    = "Jahn";
            fetchedUser.Email       = "*****@*****.**";
            fetchedUser.PhoneNumber = "(098) 765-4321";

            using (var context = new ApplicationDbContext(Options))
            {
                UserService service = new UserService(context);

                service.UpdateUser(fetchedUser);


                secondFetch = service.GetUser(1);
                Assert.AreEqual("Jess", fetchedUser.FirstName);
                Assert.AreEqual("Jahn", fetchedUser.LastName);
                Assert.AreEqual("*****@*****.**", fetchedUser.Email);
                Assert.AreEqual("(098) 765-4321", fetchedUser.PhoneNumber);
                Assert.AreEqual("WA", fetchedUser.State);
            }
        }
        public Mentee AddMentee(Mentee mentee)
        {
            string query = "INSERT INTO `mentoringacademy`.`Mentee` (Mentee_id, User_id, Mentor_id, Qualification) VALUES(" + mentee.Mentee_id + "," + mentee.User_id + ", " + mentee.Mentor_id + ", '" + mentee.Qualification + "')";
            var    con   = new DBConnect();

            con.Insert(query);

            return(mentee);

            throw new NotImplementedException();
        }
        public Mentee UpdateMentee(string id, Mentee mentee)
        {
            string query = "UPDATE `mentoringacademy`.`Mentee` SET User_id='" + mentee.User_id + "', Mentor_id='" + mentee.Mentor_id + "', Qualification='" + mentee.Qualification + "' WHERE Mentee_id='" + id + "'";
            var    con   = new DBConnect();

            con.Update(query);

            return(mentee);

            throw new NotImplementedException();
        }
示例#14
0
 public ActionResult Edit([Bind(Include = "MenteeID,FirstName,LastName,Email,Degree,CellPhoneNumber,PassWord,DateOfBirth,Points,Province,Rating,LearningInstitution,PreferredJobIndustry,PreferredWorkLocation,Status,AdministratorID")] Mentee mentee)
 {
     if (ModelState.IsValid)
     {
         db.Entry(mentee).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.AdministratorID = new SelectList(db.Administrator, "AdministratorID", "Name", mentee.AdministratorID);
     return(View(mentee));
 }
示例#15
0
            public Task <Response> Handle(Request request, CancellationToken cancellationToken)
            {
                var mentee = new Mentee(request.Mentee.FirstName, request.Mentee.LastName, request.Mentee.EmailAddress);

                _eventStore.Save(mentee);

                return(Task.FromResult(new Response()
                {
                    MenteeId = mentee.MenteeId
                }));
            }
示例#16
0
        public async Task <IActionResult> Create([Bind("MenteeId,LevelId,MenteeName,Age")] Mentee mentee)
        {
            if (ModelState.IsValid)
            {
                _context.Add(mentee);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["LevelId"] = new SelectList(_context.Set <Level>(), "LevelId", "LevelId", mentee.LevelId);
            return(View(mentee));
        }
        public void FindUser_MultipleUser_Pass()
        {
            User fetchedUser  = null;
            User fetchedUser2 = null;
            User stagedUser   = null;
            User stagedUser2  = null;

            using (var context = new ApplicationDbContext(Options))
            {
                UserService service = new UserService(context);

                stagedUser = new Mentee
                {
                    FirstName   = "Kyle",
                    LastName    = "Burgi",
                    Email       = "*****@*****.**",
                    PhoneNumber = "(123) 456-7890",
                    State       = "WA",
                    City        = "Spokane"
                };

                stagedUser2 = new Mentee
                {
                    FirstName   = "Kyle2",
                    LastName    = "Burgi2",
                    Email       = "[email protected]",
                    PhoneNumber = "(123) 456-78902",
                    State       = "WA2",
                    City        = "Spokane2"
                };

                service.AddUser(stagedUser);
                service.AddUser(stagedUser2);
            }

            using (var context = new ApplicationDbContext(Options))
            {
                UserService service = new UserService(context);
                fetchedUser = service.GetUser(1);
            }

            using (var context = new ApplicationDbContext(Options))
            {
                UserService service = new UserService(context);
                fetchedUser2 = service.GetUser(2);
            }

            //Assert.AreEqual(stagedUser, fetchedUser);
            Assert.AreEqual(1, fetchedUser.Id);
            //Assert.AreEqual(stagedUser2, fetchedUser2);
            Assert.AreEqual(2, fetchedUser2.Id);
        }
示例#18
0
 public HttpResponseMessage AddMentee([FromBody] Mentee mentee)
 {
     {
         if (ModelState.IsValid)
         {
             _service.AddMentee(mentee);
             return(new HttpResponseMessage(HttpStatusCode.OK));
         }
         else
         {
             return(new HttpResponseMessage(HttpStatusCode.BadRequest));
         }
     }
 }
示例#19
0
        // GET: Mentees/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Mentee mentee = db.Mentee.Find(id);

            if (mentee == null)
            {
                return(HttpNotFound());
            }
            return(View(mentee));
        }
示例#20
0
        // GET: Mentees/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Mentee mentee = db.Mentee.Find(id);

            if (mentee == null)
            {
                return(HttpNotFound());
            }
            ViewBag.AdministratorID = new SelectList(db.Administrator, "AdministratorID", "Name", mentee.AdministratorID);
            return(View(mentee));
        }
示例#21
0
        public Mentee UpdateMentee(Mentee mentee)
        {
            try
            {
                _unitOfWork.MenteeRepository.Update(mentee);
                _unitOfWork.Save();

                return(mentee);
            }
            catch (Exception ex)
            {
                _logManager.DefaultLogger.Error.Write("Mentoring.Application.MenteeService.UpdateMentee", ex);
                return(null);
            }
        }
示例#22
0
 private MenteeModel ToMenteeModel(Mentee mentee)
 {
     return(new MenteeModel
     {
         Id = mentee.Id,
         CurrentActivity = mentee.CurrentActivity,
         Email = mentee.User.Email,
         FirstMentorOption = ToMentorModel(mentee.FirstOption),
         FirstMentorOptionAccepted = mentee.FirstOptionAccepted.HasValue && mentee.FirstOptionAccepted.Value,
         SecondMentorOptionAccepted = mentee.SecondOptionAccepted.HasValue && mentee.SecondOptionAccepted.Value,
         SecondMentorOption = ToMentorModel(mentee.SecondOption),
         Name = mentee.User.Name,
         SkillFocus = mentee.Focus
     });
 }
示例#23
0
        public BaseResponseDto Delete(string menteeId)
        {
            BaseResponseDto responseDto = null;
            Guid            guid        = new Guid(menteeId);

            if (menteeId.Equals(null))
            {
                responseDto = new BaseResponseDto
                {
                    Status  = 1,
                    Message = "Faulthy mentee Id."
                };
                return(responseDto);
            }

            Mentee existingMentee = _uow
                                    .GetRepository <Mentee>()
                                    .GetAll()
                                    .FirstOrDefault(m => m.MenteeId == guid);

            if (existingMentee == null)
            {
                responseDto = new BaseResponseDto
                {
                    Status  = 2,
                    Message = "Mentor with specified id not found"
                };
                return(responseDto);
            }

            try
            {
                _uow.GetRepository <Mentee>().Delete(existingMentee);
                _uow.Commit();
            }
            catch (Exception e)
            {
                throw e;
            }

            responseDto = new BaseResponseDto
            {
                Status  = 0,
                Message = "Successfully removed mentee " + existingMentee.MenteeId + " from database."
            };

            return(responseDto);
        }
示例#24
0
        public IActionResult DeleteConfirmed(int id, EditMenteeView model)
        {
            // Настройка конфигурации AutoMapper
            var config = new MapperConfiguration(cfg => cfg.CreateMap <EditMenteeView, Mentee>());
            //.ForMember("Email", opt => opt.MapFrom(src => src.Login)));
            var mapper = new Mapper(config);
            // Выполняем сопоставление
            Mentee mentee = mapper.Map <EditMenteeView, Mentee>(model);

            unitOfWork.Mentee.Delete(mentee.MenteeId);
            unitOfWork.Save();
            //var mentee = repo.GetMentee(id);//await _context.Mentee.FindAsync(id);
            //unitOfWork.Mentee.Delete(id);// _context.Mentee.Remove(mentee);
            //unitOfWork.Save();//await _context.SaveChangesAsync();
            return(RedirectToAction(nameof(Mentee)));
        }
示例#25
0
 public ActionResult Edit(EditMenteeView model)
 {
     if (ModelState.IsValid)
     {
         // Настройка конфигурации AutoMapper
         var config = new MapperConfiguration(cfg => cfg.CreateMap <EditMenteeView, Mentee>());
         //.ForMember("Email", opt => opt.MapFrom(src => src.Login)));
         var mapper = new Mapper(config);
         // Выполняем сопоставление
         Mentee mentee = mapper.Map <EditMenteeView, Mentee>(model);
         unitOfWork.Mentee.Update(mentee);
         unitOfWork.Save();
         return(RedirectToAction("Mentee"));
     }
     return(View(model));
 }
        public void AddUser_RequiredInfo_Pass()
        {
            User fetchedUser2 = null;

            using (var context = new ApplicationDbContext(Options))
            {
                UserService service = new UserService(context);

                User u = new Mentee
                {
                    FirstName   = "Kyle",
                    LastName    = "Burgi",
                    Email       = "*****@*****.**",
                    PhoneNumber = "(123) 456-7890",
                    State       = "WA",
                    City        = "Spokane"
                };

                User u2 = new Mentee
                {
                    FirstName   = "Kyle2",
                    LastName    = "Burgi2",
                    Email       = "[email protected]",
                    PhoneNumber = "(123) 456-78902",
                    State       = "WA2",
                    City        = "Spokane2"
                };

                service.AddUser(u);
                service.AddUser(u2);

                User fetchedUser = service.GetUser(1);
                Assert.AreEqual("Kyle", fetchedUser.FirstName);
                Assert.AreEqual("Burgi", fetchedUser.LastName);
                Assert.AreEqual("*****@*****.**", fetchedUser.Email);
                Assert.AreEqual("WA", fetchedUser.State);

                fetchedUser2 = service.GetUser(2);
            }
            Assert.AreEqual("Kyle2", fetchedUser2.FirstName);
            Assert.AreEqual("Burgi2", fetchedUser2.LastName);
            Assert.AreEqual("[email protected]", fetchedUser2.Email);
            Assert.AreEqual("WA2", fetchedUser2.State);
        }
示例#27
0
        User GetUser(string studentNumber)
        {
            User          u           = null;
            SqlConnection conn        = new SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["DefaultConnection"].ConnectionString);
            SqlCommand    getUserComm = new SqlCommand("SELECT StudentNumber, FirstName, Surname, DateOfBirth, Role, GroupNumber " +
                                                       " FROM ProfileDetails WHERE StudentNumber=@studentNumber");

            // set the parameters
            getUserComm.Parameters.Add("@studentNumber", SqlDbType.VarChar);
            getUserComm.Parameters["@studentNumber"].Value = studentNumber;
            getUserComm.Connection = conn;
            conn.Open();

            using (conn)
                using (var reader = getUserComm.ExecuteReader())
                {
                    if (reader.HasRows)
                    {
                        // read the record
                        reader.Read();
                        int role = reader.GetInt32(4); // get the role of the user
                        if (role == 0)
                        {
                            u = new Mentee(studentNumber);
                        }
                        else
                        {
                            u = new Mentor(studentNumber);
                        }
                        // set the values in the object
                        u.FirstName = reader.GetString(1);
                        u.Surname   = reader.GetString(2);
                        if (!reader.IsDBNull(3))
                        {
                            u.DateOfBirth = reader.GetDateTime(3);
                        }
                        //u.Group = GetGroup(reader.GetInt32(4));
                        u.GroupNumber = (!reader.IsDBNull(4)) ? reader.GetInt32(4) : 0;
                    }
                }
            return(u);
        }
示例#28
0
 public ActionResult <Mentee> UpdateMentee(string id, [FromBody] Mentee mentee)
 {
     _service.UpdateMentee(id, mentee);
     return(mentee);
 }
示例#29
0
        public LoginResponseDTO GoogleLogin(UserLoginViewModel user)
        {
            LoginResponseDTO result = null;

            #region Check Input
            if (user == null)
            {
                result = new LoginResponseDTO
                {
                    Status  = 1,
                    Message = "User Login information must not be null",
                    Result  = null
                };
                return(result);
            }

            if (user.RoleName != "mentor" && user.RoleName != "mentee")
            {
                result = new LoginResponseDTO
                {
                    Status  = 2,
                    Message = "User missing required role",
                    Result  = null
                };
                return(result);
            }
            #endregion

            #region Check User
            User loggedUser = _uow
                              .GetRepository <User>()
                              .GetAll()
                              .SingleOrDefault(u => u.Email == user.Email);

            if (loggedUser == null)
            {
                result = new LoginResponseDTO
                {
                    Status  = 3,
                    Result  = null,
                    Message = "Email does not exist ! Please Register !"
                };
                return(result);
            }
            #endregion

            #region Check Role

            if (user.RoleName == "mentor")
            {
                Mentor mentor = _uow
                                .GetRepository <Mentor>()
                                .GetAll()
                                .SingleOrDefault(m => m.UserId == loggedUser.UserId);
                if (mentor == null)
                {
                    result = new LoginResponseDTO
                    {
                        Status  = 4,
                        Result  = null,
                        Message = "This user is not a Mentor."
                    };
                    return(result);
                }
            }
            else if (user.RoleName == "mentee")
            {
                Mentee mentee = _uow
                                .GetRepository <Mentee>()
                                .GetAll()
                                .SingleOrDefault(m => m.UserId == loggedUser.UserId);
                if (mentee == null)
                {
                    result = new LoginResponseDTO
                    {
                        Status  = 4,
                        Result  = null,
                        Message = "This user is not a Mentee."
                    };
                    return(result);
                }
            }

            #endregion

            string jwtToken = tokenManager.CreateUserAccessToken(new UserAuthModel
            {
                Id       = loggedUser.UserId,
                Email    = loggedUser.Email,
                RoleName = user.RoleName
            });

            result = new LoginResponseDTO
            {
                Status  = 0,
                Message = "Login Successfully.",
                Result  = jwtToken
            };

            return(result);
        }
        public async Task Seed()
        {
            this.ctx.Database.EnsureCreated();

            string[] roles = { "Admin", "Director", "Mentor", "Mentee" };

            foreach (var role in roles)
            {
                var roleExist = await this.roleManager.RoleExistsAsync(role);

                if (!roleExist)
                {
                    await this.roleManager.CreateAsync(new IdentityRole <int>(role));
                }
            }

            //// Add Admin User
            var user = await this.userManager.FindByEmailAsync("*****@*****.**");

            if (user == null)
            {
                user = new MeticulousUser()
                {
                    UserName = "******",
                    Email    = "*****@*****.**"
                };

                var result = await this.userManager.CreateAsync(user, "War3agle!");

                if (result != IdentityResult.Success)
                {
                    throw new InvalidOperationException("Failed to create default user");
                }
                else
                {
                    await this.userManager.AddToRoleAsync(user, "Admin");
                }
            }
            //// End Add Admin User

            ////Add Director
            var director = await this.userManager.FindByEmailAsync("*****@*****.**");

            if (director == null)
            {
                director = new MeticulousUser()
                {
                    UserName = "******",
                    Email    = "*****@*****.**"
                };

                var directorResult = await this.userManager.CreateAsync(director, "War3agle!");

                if (directorResult == IdentityResult.Success)
                {
                    await this.userManager.AddToRoleAsync(director, "Director");
                }
            }
            ////End Add Director

            ////Add Mentee
            var mentee = await this.userManager.FindByEmailAsync("*****@*****.**");

            if (mentee == null)
            {
                mentee = new MeticulousUser()
                {
                    UserName  = "******",
                    Email     = "*****@*****.**",
                    FirstName = "Ty",
                    LastName  = "Wright"
                };

                var menteeResult = await this.userManager.CreateAsync(mentee, "War3agle!");

                if (menteeResult == IdentityResult.Success)
                {
                    await this.userManager.AddToRoleAsync(mentee, "Mentee");

                    var menteeAddress = new Address()
                    {
                        address1 = "709 Stonewall Drive",
                        city     = "Irondale",
                        state    = "AL",
                        zip      = "35210"
                    };

                    var menteeSchoolAddress = new Address()
                    {
                        address1 = "6100 Old Leeds Rd",
                        city     = "Irondale",
                        state    = "AL",
                        zip      = "35210"
                    };

                    var menteeSchool = new School()
                    {
                        school_name = "Shades Valley High School",
                        address     = menteeSchoolAddress,
                        principal   = "Antjuan Marsh",
                        system      = ctx.Systems.Find(1)
                    };

                    var newMentee = new Mentee()
                    {
                        id             = mentee.Id,
                        first_name     = "Ty",
                        middle         = "Kristopher",
                        last_name      = "Wright",
                        gender         = "M",
                        dob            = Convert.ToDateTime("2000-08-29T00:00:00"),
                        email          = "*****@*****.**",
                        created_on     = Convert.ToDateTime("2017-12-13T00:00:00"),
                        modified_on    = Convert.ToDateTime("2017-12-13T00:00:00"),
                        is_active      = true,
                        address        = menteeAddress,
                        school         = menteeSchool,
                        classification = ctx.Classifications.Find(4)
                    };

                    this.ctx.Addresses.Add(menteeAddress);
                    this.ctx.Addresses.Add(menteeSchoolAddress);
                    this.ctx.Schools.Add(menteeSchool);
                    this.ctx.Mentees.Add(newMentee);
                    this.ctx.SaveChanges();
                }
            }
            ////End Add Mentee

            ////Add Mentor
            var mentor = await this.userManager.FindByEmailAsync("*****@*****.**");

            if (mentor == null)
            {
                mentor = new MeticulousUser()
                {
                    UserName  = "******",
                    Email     = "*****@*****.**",
                    FirstName = "Joe",
                    LastName  = "Mentor"
                };

                var mentorResult = await this.userManager.CreateAsync(mentor, "War3agle!");

                if (mentorResult == IdentityResult.Success)
                {
                    await this.userManager.AddToRoleAsync(mentor, "Mentor");

                    var mentorAddress = new Address()
                    {
                        address1 = "1254 Mentor Way",
                        city     = "Birmingham",
                        state    = "AL",
                        zip      = "35207"
                    };

                    var newMentor = new Mentor()
                    {
                        id          = mentor.Id,
                        first_name  = "Joe",
                        last_name   = "Mentor",
                        gender      = "M",
                        address     = mentorAddress,
                        is_active   = true,
                        created_on  = Convert.ToDateTime(DateTime.Now),
                        modified_on = Convert.ToDateTime(DateTime.Now),
                        mentees     = null
                    };

                    this.ctx.Addresses.Add(mentorAddress);
                    this.ctx.Mentors.Add(newMentor);
                    this.ctx.SaveChanges();
                }
            }//// End Add Mentor

            ////Add Guardian
            var guardian = ctx.Guardians.Single(x => x.email == "*****@*****.**");

            if (guardian == null)
            {
                guardian = new Guardian()
                {
                    first_name = "Anthony",
                    last_name  = "Wright II",
                    address    = ctx.Addresses.SingleOrDefault(x => x.address1 == "709 Stonewall Dr"),
                    gender     = "M",
                    email      = "*****@*****.**",
                    middle     = "Q",
                    children   = null
                };

                this.ctx.Guardians.Add(guardian);
                this.ctx.SaveChanges();
            }
            //// End Add Guardian

            ////Update Mentee
            var updatedMentee = ctx.Mentees.SingleOrDefault(x => x.email == "*****@*****.**");
            var addedMentor   = ctx.Mentors.SingleOrDefault(x => x.last_name == "Mentor");
            var addedGuardian = ctx.Guardians.SingleOrDefault(x => x.email == "*****@*****.**");

            if (addedMentor.mentees == null)
            {
                addedMentor.mentees = new List <Mentee>();
                addedMentor.mentees.Add(updatedMentee);
                this.ctx.Mentors.Update(addedMentor);
                this.ctx.SaveChanges();
            }

            if (addedGuardian.children == null)
            {
                addedGuardian.children = new List <Mentee>();
                addedGuardian.children.Add(updatedMentee);
                this.ctx.Guardians.Update(addedGuardian);
                this.ctx.SaveChanges();
            }
        }