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()) }); }
public ActionResult Show(int id, int page = 1) { var providers = _providerService.GetByCategory(id).ToList(); var pageRange = _helper.GetPageRange(page, _helper.GetPagesCount(providers.Count, Constants.ItemsPerPage)); ViewBag.HasPrice = true; ViewBag.Controller = "Provider"; ViewBag.CategoryId = id; return(View("_ProviderByCategoryIndex", _providerMapper .MapToIndexProviderViewModel(_providerService.GetPage(providers, page, Constants.ItemsPerPage), new[] { page, pageRange[0], pageRange[1] }))); }
public ProfileViewModel MapToProfileViewModel(User user) { var orders = _orderMapper.MapToIndexOrderViewModel(_orderService.GetUserOrders(user.Id)); var providers = _providerMapper.MapToIndexProviderViewModel(_providerService.GetUserProviders(user.Id)); var orderResponses = _orderResponseMapper.MapToIndexOrderResponseViewModel(_orderService.GetUserResponses(user.Id)); var providerResponses = _providerResponseMapper.MapToIndexProviderResponseViewModel(_providerService.GetUserResponses(user.Id)); return(new ProfileViewModel { Id = user.Id, Avatar = user.Avatar.Url, UserName = user.UserName, Name = user.Profile.Name, Orders = orders, Providers = providers, OrderResponses = orderResponses, ProviderResponses = providerResponses }); }