Esempio n. 1
0
        public async Task <Response <int> > Delete(OperadorESDto.RQDelete input)
        {
            try
            {
                var responseDelete = new Response <int>();
                var modelReq       = this._mapper.Map <TM_OPERADOR_ES>(input);
                var result         = await this._operadorESDomain.Delete(modelReq);

                var nestadoProceso = Int32.Parse(result.STR_ESTADOPROCESO);
                if (nestadoProceso == 1)
                {
                    responseDelete.IsSuccess = true;
                    responseDelete.Data      = result.NUM_IDNOMINAXSUCURSAL.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;
            }
        }
Esempio n. 2
0
        public async Task <Response <int> > Delete([FromBody] OperadorESDto.RQDelete input)
        {
            try
            {
                input.nIdSession = 0;
                input.sUsuario   = "";
                var oUserInfo = await this._jwtApplication.GetUserInfo(User);

                if (oUserInfo.IsSuccess)
                {
                    input.nIdSession = Int32.Parse(oUserInfo.Data.sIdSession);
                    input.sUsuario   = oUserInfo.Data.sUsername;
                }
                return(await this._operadorESApplication.Delete(input));
            }
            catch (Exception ex)
            {
                _ = this._logApplication.SetLog(EnumLogType.TEXT_N_EMAIL, EnumLogCategory.ERROR, "OperadorES-Delete", ex, input);
                return(new Response <int>
                {
                    Message = "ERR-Fallo en el servidor"
                });
            }
        }