public async Task <IActionResult> Delete(EmpresaDto.RQDelete oItem)
        {
            try
            {
                var oUserInfo = await this._jwtApplication.GetUserInfo(User);

                if (!oUserInfo.IsSuccess)
                {
                    return(Ok(oUserInfo));
                }

                oItem.nIdSession    = int.Parse(oUserInfo.Data.sIdSession);
                oItem.sUsuario      = oUserInfo.Data.sUsername;
                oItem.nIdEntidadSSO = oUserInfo.Data.nIdEmpresa;
                var oResult = await this._empresaApplication.Delete(oItem);

                return(Ok(oResult));
            }
            catch (Exception ex)
            {
                _ = this._logApplication.SetLog(EnumLogType.TEXT_N_EMAIL, EnumLogCategory.ERROR, "Empresa-Delete", ex, oItem);
                return(Ok(new Response <string> {
                    Message = "ERR-Fallo en el servidor"
                }));
            }
        }
Ejemplo n.º 2
0
        public async Task <Response <int> > Delete(EmpresaDto.RQDelete input)
        {
            try
            {
                var responseDelete = new Response <int>();
                var modelReq       = this._mapper.Map <TM_EMPRESA>(input);
                var result         = await this._empresaDomain.Delete(modelReq);

                var nestadoProceso = Int32.Parse(result.STR_ESTADOPROCESO);
                if (nestadoProceso == 1)
                {
                    responseDelete.IsSuccess = true;
                    responseDelete.Data      = result.NUM_IDEMPRESA.Value;
                    responseDelete.Message   = result.STR_MENSAJE;
                }
                else if (nestadoProceso > 1)
                {
                    responseDelete.Message = result.STR_MENSAJE;
                }
                else if (nestadoProceso == 0)
                {
                    throw new Exception(result.STR_MENSAJE);
                }
                return(responseDelete);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }