public IActionResult Create(/*long customerId,*/ [FromBody] CustomerCreateDto customerCreateDto) { //Logic.BL.Common.Domain.Singleton.LoggerBasSingleton.Instance.Log("Inicio de función"); //Logic.BL.Common.Domain.Singleton.LoggerThreadSafe1Singleton.Instance.Log("Inicio de función"); //Logic.BL.Common.Domain.Singleton.LoggerThreadSafe2Singleton.Instance.Log("Inicio de función"); //Logic.BL.Common.Domain.Singleton.LoggerThreadSafe3Singleton.Instance.Log("Inicio de función"); Logic.BL.Common.Domain.Singleton.LoggerThreadSafe4LazySingleton.Instance.Log("Inicio Evento"); bool uowStatus = false; try { uowStatus = _unitOfWork.BeginTransaction(); Customer customer = _customerCreateAssembler.toEntity(customerCreateDto); _customerRepository.Create(customer); _unitOfWork.Commit(uowStatus); return(StatusCode(StatusCodes.Status201Created, new ApiStringResponseDto("Created!")));//Ok(); Logic.BL.Common.Domain.Singleton.LoggerThreadSafe4LazySingleton.Instance.Log("Termino Evento Correctamente"); } catch (Exception e) { Logic.BL.Common.Domain.Singleton.LoggerThreadSafe4LazySingleton.Instance.Log("Error Evento" + e.ToString()); _unitOfWork.Rollback(uowStatus); //return StatusCode(500, new { error = e.Message }); Console.WriteLine(e.StackTrace); return(StatusCode(StatusCodes.Status500InternalServerError, new ApiStringResponseDto("Internal Server Error"))); } }
public IActionResult Create(/*long customerId,*/ [FromBody] CustomerCreateDto customerCreateDto) { bool uowStatus = false; try { uowStatus = _unitOfWork.BeginTransaction(); Customer customer = _customerCreateAssembler.toEntity(customerCreateDto); _customerRepository.Create(customer); _unitOfWork.Commit(uowStatus); return(StatusCode(StatusCodes.Status201Created, new ApiStringResponseDto("Created!")));//Ok(); } catch (Exception e) { _unitOfWork.Rollback(uowStatus); //return StatusCode(500, new { error = e.Message }); Console.WriteLine(e.StackTrace); return(StatusCode(StatusCodes.Status500InternalServerError, new ApiStringResponseDto("Internal Server Error"))); } }