MqttApps/mqttApi/src/Mqtt.App.Application/Persistencia/user/commands/UpdateUser/UpdateUserCommand.cs

33 lines
971 B
C#

using AutoMapper;
using Mqtt.App.Application.Interfaces;
using Mqtt.App.Application.Persistencia.user.commands.CreateUser;
using Mqtt.App.Domain.Entities.User;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Mqtt.App.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;
}
}
}