public static void ToBllUserBlockInfo(this UserEntity userEntity, UserBlockViewModel viewModel)
 {
     if (viewModel != null)
     {
         userEntity.BlockTime = viewModel.BlockDate;
         userEntity.IsBlocked = viewModel.IsBlocked;
         userEntity.BlockReason = viewModel.BlockReason;
     }
 }
Ejemplo n.º 2
0
 public ActionResult UserBlocked(string userLogin)
 {
     var user = _userService.GetUserEntityByLogin(userLogin);
     var blockModel = new UserBlockViewModel()
     {
         Id = user.Id,
         BlockDate = user.BlockTime,
         BlockReason = user.BlockReason
     };
     return View(blockModel);
 }
Ejemplo n.º 3
0
 public bool BlockUser(UserBlockViewModel blockModel)
 {
     if (!ModelState.IsValid) return false;
     var user = _userService.GetUserEntity(blockModel.Id);
     if (user == null)
     {
         return false;
     }
     user.ToBllUserBlockInfo(blockModel);
     _userService.UpdateUser(user);
     return true;
 }