コード例 #1
0
 public IActionResult Edit(UsersViewModel user)
 {
     user.Birthdate = user.DateTimeBirthdate.ToString("D");
     usersAndRewardsStorage.UpdateUser(user.ConvertUserToDomainModel());
     usersAndRewardsStorage.RewardUser(user.ConvertUserToDomainModel());
     return(RedirectToAction(nameof(Index)));
 }
コード例 #2
0
        public IActionResult Edit(int?id)
        {
            UsersViewModel userEdit = usersAndRewardsStorage.GetUsersList().FirstOrDefault(td => td.Id == id.Value).ConvertUserToViewModel();

            userEdit = usersAndRewardsStorage.ExpandUserRewardsList(userEdit.ConvertUserToDomainModel()).ConvertUserToViewModel();
            userEdit.DateTimeBirthdate = Convert.ToDateTime(userEdit.Birthdate);
            return(View("AddOrEdit", userEdit));
        }
コード例 #3
0
        public IActionResult Add(UsersViewModel user)
        {
            UsersModel newDomaiUser = user.ConvertUserToDomainModel();

            newDomaiUser.Id = usersAndRewardsStorage.AddUser(newDomaiUser);
            usersAndRewardsStorage.RewardUser(newDomaiUser);
            return(RedirectToAction(nameof(Index)));
        }