public async Task <Response <int> > Insert([FromBody] RutaDto.RQInsert 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; input.nIdentidadUsuario = oUserInfo.Data.nIdEmpresa; } var responseInsert = new Response <int>(); return(await this._rutaApplication.Insert(input)); } catch (Exception ex) { _ = this._logApplication.SetLog(EnumLogType.TEXT_N_EMAIL, EnumLogCategory.ERROR, "RutaController-Insert", ex, input); return(new Response <int> { Message = "ERR-Fallo en el servidor" }); } }
public async Task <Response <int> > Insert(RutaDto.RQInsert input) { try { var responseInsert = new Response <int>(); var modelReq = this._mapper.Map <TM_RUTA>(input); var result = await this._rutaDomain.Insert(modelReq); var nestadoProceso = Int32.Parse(result.STR_ESTADOPROCESO); if (nestadoProceso == 1) { responseInsert.IsSuccess = true; responseInsert.Data = result.NUM_IDRUTA.Value; responseInsert.Message = result.STR_MENSAJE; } else if (nestadoProceso > 1) { responseInsert.Message = result.STR_MENSAJE; } else if (nestadoProceso == 0) { throw new Exception(result.STR_MENSAJE); } return(responseInsert); } catch (Exception ex) { throw ex; } }