Пример #1
0
 public IndexAdminViewModel MapToIndexAdminViewModel()
 {
     return(new IndexAdminViewModel
     {
         Users = _userService.GetAll().ToList().Select(x => _userMapper.MapToUserDtoModel(x)),
         Orders = _orderMapper.MapToIndexOrderViewModel(_orderService.GetAll()),
         OrderResponses = _orderResponseMapper.MapToIndexOrderResponseViewModel(_orderService.GetAllOrderResponses()),
         Providers = _providerMapper.MapToIndexProviderViewModel(_providerService.GetAll()),
         ProviderResponses = _providerResponseMapper.MapToIndexProviderResponseViewModel(_providerService.GetAllProviderResponses()),
         OrderCategories = _orderCategoryMapper.MapToIndexOrderCategoryViewModel(_orderService.GetCategories()),
         ProviderCategories = _providerCategoryMapper.MapToIndexProviderCategoryViewModel(_providerService.GetCategories())
     });
 }
Пример #2
0
        public ActionResult Register(RegisterViewModel viewModel)
        {
            if (!ModelState.IsValid)
            {
                return(View(viewModel));
            }
            var userDto = _userMapper.MapToUserDtoModel(viewModel);

            _userService.Create(userDto);
            return(Login(new LoginViewModel
            {
                UserName = userDto.UserName,
                Password = userDto.Password
            }));
        }