VentaUniformes/src/VentaUniformes.Application/Persistencia/user/commands/UpdateUser/UpdateUserCommand.cs

33 lines
995 B
C#

using AutoMapper;
using VentaUniformes.Application.Interfaces;
using VentaUniformes.Application.Persistencia.user.commands.CreateUser;
using VentaUniformes.Domain.Entities.User;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace VentaUniformes.Application.Persistencia.user.commands.UpdateUser
{
public class UpdateUserCommand : IupdateUserCommand
{
IPersistenciaService _persistenciaService;
IMapper _mapper;
public UpdateUserCommand(IPersistenciaService persistenciaService, IMapper mapper)
{
_persistenciaService = persistenciaService;
_mapper = mapper;
}
public async Task<UpdateUserModel> Execute(UpdateUserModel model)
{
var entity = _mapper.Map<UserEntity>(model);
//aqui se guarda realmente
await _persistenciaService.UpdateUser(entity);
return model;
}
}
}