public TemaResponse Execute(CreateTemaInput input)
        {
            var temaResponse = new TemaResponse();

            try
            {
                Log.Information("Creando Tema Con nombre [{NewName}]...", input?.Nombre);
                TemaEntity temaEntity = Mapper.Map <CreateTemaInput, TemaEntity>(input);
                temaEntity.FechaCreacion = DateTime.Now;
                temaResponse.Tema        = Repository.Create(temaEntity);
                temaResponse.StatusCode  = 200;
                Log.Information("Tema creado con el nombre [{NewName}] con el Id: [{Id}]", temaResponse.Tema.Nombre, temaResponse.Tema.Id);
            }
            catch (Exception exception)
            {
                Log.Error(exception, "Error al crear el Tema: [{NewName}].", input?.Nombre);
                HandleErrors(temaResponse, exception);
            }
            return(temaResponse);
        }
Exemple #2
0
 public IActionResult Crear(CreateTemaInput tema)
 {
     return(ExecuteAndHandleRequest(() => TemaRequestAggregate.CreateTemaRequest.Execute(tema)));
 }