public async Task <IActionResult> UpdateProduct( [FromForm] ProductForm form, [FromServices] GetProduct getProduct, [FromServices] UpdateProduct updateProduct, [FromServices] S3Client s3Client) { var product = getProduct.Do(form.Id); product.Description = form.Description; product.Series = form.Series; product.StockDescription = form.StockDescription; if (form.Images != null && form.Images.Any()) { product.Images = new List <Image>(); var results = await Task.WhenAll(UploadFiles(s3Client, form.Images)); product.Images.AddRange(results.Select((path, index) => new Image { Index = index, Url = path, })); } await updateProduct.Update(product); return(Ok()); }
public IActionResult OnGet(string slug, [FromServices] GetProduct getProduct) { SelectedProduct = getProduct.Do(slug); if (SelectedProduct == null) { return(RedirectToPage("/not-found")); } return(Page()); }
public async Task <IActionResult> OnGet(string name, [FromServices] GetProduct getProduct) { Product = await getProduct.Do(name.Replace("-", " ")); if (Product == null) { return(RedirectToPage("Index")); } else { return(Page()); } }
public GetProduct.Response GetProduct(int id) => _getProduct.Do(id);
public IActionResult GetProduct([FromServices] GetProduct getProduct, int id) => Ok(getProduct.Do(id));
public IActionResult GetProduct( Guid id, [FromServices] GetProduct getProduct) => Ok(getProduct.Do(id));
public async Task <IActionResult> GetProduct(string slug, [FromServices] GetProduct getProduct) => Ok(await getProduct.Do(slug));
public IActionResult GetProduct( int id, [FromServices] GetProduct getProducts) => Ok(getProducts.Do(id));
public object GetProduct(int id, [FromServices] GetProduct getProduct) => getProduct.Do(id);
public async Task <IActionResult> GetProduct(int id, [FromServices] GetProduct getProduct) => Ok(await getProduct.Do(id));
public IActionResult GetProduct([FromServices] GetProduct getProduct, int productId) { return(Json(getProduct.Do(productId))); }