public BaseResponse <List <GenderResponse> > GetAll() { return(BaseResponse <List <GenderResponse> > .ConstructResponse( HttpStatusCode.OK, HttpStatusCode.OK.ToString(), genderService.GetAllGenders())); }
public async Task <IActionResult> OnGetAsync(string returnUrl = null) { ReturnUrl = returnUrl; ExternalLogins = (await _signInManager.GetExternalAuthenticationSchemesAsync()).ToList(); this.ViewModel.Genders = genderService.GetAllGenders(); return(Page()); }
public async Task <ActionResult <IEnumerable <GenreDto> > > GetAllAsync() { IEnumerable <Genre> genders = null; await Task.Run(() => { genders = _genderService.GetAllGenders(); }); var gendersDto = _mapper.Map <IEnumerable <GenreDto> >(genders); return(Ok(gendersDto)); }
public IActionResult GetAllGenders() { try { IEnumerable <Gender> genders = _genderService.GetAllGenders(); return(Ok(genders)); } catch (Exception ex) { _logger.Error(ex, "Error in call : api/gender/GetAllGenders"); return(StatusCode(StatusCodes.Status500InternalServerError, "Internal server error")); } }
public AddProductContentsDTO GetAddProductContents() { var listGendersDto = _genderService.GetAllGenders(); var addProductDTO = new AddProductContentsDTO() { Brands = mapper.Map <List <Brand>, List <BrandDTO> >(_brandRepository.GetAllBrands()), Categories = mapper.Map <List <Category>, List <CategoryDTO> >(_categoryRepository.GetAllCategories()), Genders = listGendersDto, ProductTypes = mapper.Map <List <ProductType>, List <ProductTypeDTO> >(_productTypeRepository.GetAllProductTypes()), Sizes = mapper.Map <List <ProductSize>, List <ProductSizeDTO> >(_productSizeRepository.GetAllProductSizes()) }; return(addProductDTO); }
public async Task <IActionResult> GetAll() { try { var query = await _service.GetAllGenders(); if (query.Any()) { return(Ok(query)); } else { return(NoContent()); } } catch (Exception ex) { return(Conflict(new { Response = $"Excepción: {ex.Message}" })); } }
public EditProductViewModel GetEditProductById(int productId) { var product = _productService.GetProductById(productId); var editProductViewModel = new EditProductViewModel() { Id = productId, ProductName = product.ProductName, Description = product.Description, Genders = SelectListItemHelper.BuildGendersDropDownList(_genderService.GetAllGenders()), HeroImageCurrent = product.HeroImage, HeroTitle = product.HeroTitle, Brands = SelectListItemHelper.BuildDropDownList(_brandService.GetAllBrands()), Price = product.Price.ToString(), Sizes = mapper.Map <List <ProductSizeDTO>, List <ProductSizeViewModel> >(product.Sizes), SizesJson = JsonConvert.SerializeObject(product.Sizes) }; foreach (var gender in editProductViewModel.Genders) { if (gender.Text == product.Gender) { gender.Selected = true; } } var listProductTypes = _productTypeService.GetAllProductTypes(); foreach (var productType in listProductTypes) { editProductViewModel.ProductTypes.Add(new SelectListItem() { Value = productType.Id.ToString(), Text = productType.Value, Selected = productType.Id == product.CategoryId }); } foreach (var image in product.Images) { //TODO: Try put this in mapper if (image.Image.Length > 1) { editProductViewModel.ImagesSrc.Add($"data:image/jpeg;base64,{Convert.ToBase64String(image.Image)}"); editProductViewModel.ImagesBytes.Add(image.Image); } } var listCategories = _categoryService.GetAllCategories(); foreach (var category in listCategories) { editProductViewModel.Categories.Add(new SelectListItem() { Value = category.Id.ToString(), Text = category.Value, Selected = category.Id == product.CategoryId });; } return(editProductViewModel); }
public Task <IEnumerable <Gender> > GetAll() => _genderService.GetAllGenders();