public async Task <IActionResult> AddPicture(AddPictureProductInputModel inputModel) { if (!ModelState.IsValid) { return(this.View(inputModel)); } var picturePath = await this.pictureService .SavePicture(inputModel.Id, inputModel.Picture, GlobalConstants.DefaultPicturesPath); await this.productService.AddPicturePath(inputModel.Id, picturePath); return(this.Redirect($"/Products/Details/{inputModel.Id}")); }
public async Task <IActionResult> AddPicture(string id) { var product = await this.productService.GetProductById(id); if (product == null) { return(NotFound()); } var inputModel = new AddPictureProductInputModel() { Id = product.Id }; return(this.View(inputModel)); }