Exemplo n.º 1
0
        public static MyInfoViewModel From(Models.User user)
        {
            MyInfoViewModel model = new MyInfoViewModel();
            model.Contact = ContactViewModel.From(user.Contact);

            model.Email = user.Email;
            model.Contact = ContactViewModel.From(user.Contact);
            model.IsSignForNews = user.IsSignedForNews;
            return model;
        }
Exemplo n.º 2
0
        public static MyInfoViewModel From(Models.User user)
        {
            MyInfoViewModel model = new MyInfoViewModel();

            model.Contact = ContactViewModel.From(user.Contact);

            model.Email         = user.Email;
            model.Contact       = ContactViewModel.From(user.Contact);
            model.IsSignForNews = user.IsSignedForNews;
            return(model);
        }
Exemplo n.º 3
0
        public ActionResult MyInfo(MyInfoViewModel viewModel)
        {
            User user = CurrentUser();
            if (!user.Email.Equals(viewModel.Email))
            {
                if (daoTemplate.FindUniqueByField<User>(Models.User.EmailProperty, viewModel.Email) != null)
                {
                    ModelState.AddModelError("Email", "Пользователь с таким email уже зарегистрирован");
                }
            }

            if (ModelState.IsValid)
            {
                user.Contact = Contact.From(viewModel.Contact);
                user.Email = viewModel.Email;
                user.IsSignedForNews = viewModel.IsSignForNews;
            }
            return View(viewModel);
        }