You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
25 lines
990 B
25 lines
990 B
using Microsoft.eShopWeb.ApplicationCore.Entities;
|
|
using Microsoft.eShopWeb.ApplicationCore.Interfaces;
|
|
using Microsoft.eShopWeb.Web.Interfaces;
|
|
using Microsoft.eShopWeb.Web.ViewModels;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace Microsoft.eShopWeb.Web.Services
|
|
{
|
|
public class CatalogItemViewModelService : ICatalogItemViewModelService
|
|
{
|
|
private readonly IAsyncRepository<CatalogItem> _catalogItemRepository;
|
|
|
|
public CatalogItemViewModelService(IAsyncRepository<CatalogItem> catalogItemRepository)
|
|
{
|
|
_catalogItemRepository = catalogItemRepository;
|
|
}
|
|
|
|
public async Task UpdateCatalogItem(CatalogItemViewModel viewModel)
|
|
{
|
|
var existingCatalogItem = await _catalogItemRepository.GetByIdAsync(viewModel.Id);
|
|
existingCatalogItem.UpdateDetails(viewModel.Name, existingCatalogItem.Description, viewModel.Price);
|
|
await _catalogItemRepository.UpdateAsync(existingCatalogItem);
|
|
}
|
|
}
|
|
}
|
|
|