Beispiel #1
0
        public ActionResult UpdateUser()
        {
            var    config = new MapperConfiguration(cfg => cfg.CreateMap <User, UserMV>());
            var    mapper = new Mapper(config);
            UserMV model  = mapper.Map <UserMV>(userLogic.FindUserByLogin(User.Identity.Name));

            return(View(model));
        }
Beispiel #2
0
        public ActionResult Index()
        {
            var           config = new MapperConfiguration(cfg => cfg.CreateMap <User, UserMV>());
            var           mapper = new Mapper(config);
            List <UserMV> users  = mapper.Map <List <UserMV> >(userLogic.Select());
            UserMV        myUser = users.Find(user => user.Login == User.Identity.Name);

            users.Remove(myUser);
            return(View(users));
        }
Beispiel #3
0
 public ActionResult UpdateUser(UserMV model)
 {
     if (ModelState.IsValid)
     {
         userLogic.Update(model.Login, model.Surname, model.Name, model.Patronymic, model.Age);
         return(RedirectToAction("Index", "Profile"));
     }
     else
     {
         ModelState.AddModelError("", "Неправильные данные в полях");
     }
     return(RedirectToAction("Index", "Profile"));
 }