public static void CreateUser(DTO.MealPlannerDTO mealPlannerDTO)
        {
            var db   = new MealPlannerDbEntities();
            var user = convertToEntity(mealPlannerDTO);

            db.Users.Add(user);
            db.SaveChanges();
        }
Ejemplo n.º 2
0
        public static List <DTO.MealPlannerDTO> convertToDTO(List <User> users)
        {
            var usersDTO = new List <DTO.MealPlannerDTO>();

            foreach (var user in users)
            {
                var userDTO = new DTO.MealPlannerDTO();
                userDTO.UserName = user.UserName;
                userDTO.Password = user.Password;
                //userDTO.Email = user.Email;

                usersDTO.Add(userDTO);
            }

            return(usersDTO);
        }
Ejemplo n.º 3
0
        protected void CreateAccountButton_Click(object sender, EventArgs e)
        {
            if (!textBoxDataIsValid())
            {
                return;
            }
            MealPlanner.DTO.MealPlannerDTO mealPlannerDTO = new DTO.MealPlannerDTO();

            mealPlannerDTO.UserName = UserNameTextBox.Text;
            mealPlannerDTO.Email    = EmailTextBox.Text;
            mealPlannerDTO.Password = PasswordTextBox.Text;

            Session["userName"] = mealPlannerDTO.UserName;


            Domain.MealPlannerManager.CreateUser(mealPlannerDTO);
        }
Ejemplo n.º 4
0
        protected void signInButton_Click(object sender, EventArgs e)
        {
            MealPlanner.DTO.MealPlannerDTO mealPlannerDTO = new DTO.MealPlannerDTO();

            mealPlannerDTO.UserName = UserNameSigninTextBox.Text;

            mealPlannerDTO.Password = PasswordSigninTextBox.Text;



            string result = "";

            result = Domain.SignInManager.SignInResult(mealPlannerDTO);


            resultLabel.Text = result;
        }
Ejemplo n.º 5
0
 public static void CreateUser(DTO.MealPlannerDTO mealPlannerDTO)
 {
     Persistence.MealPlannerRepository.CreateUser(mealPlannerDTO);
 }
Ejemplo n.º 6
0
        public static string SignInResult(DTO.MealPlannerDTO mealPlannerDTO)
        {
            var userList = Persistence.SignInRepository.GetUser();

            return(IsLoginRight(mealPlannerDTO, userList));
        }