/// <summary> /// Crea un cotización en la base de datos /// </summary> /// <param name="Cotización"></param> /// <returns></returns> public async Task <CotizaciónDto> AdicionarAsync(CotizaciónDto Cotización) { HttpResponseMessage response; var elUri = $"{_MyStringUri}/Adicionar"; Cotización.EstadoId = EstadoEnum.Activo; string json = JsonSerializer.Serialize(Cotización); try { response = await _consumirAPIService.POSTRequestAsync(elUri, json); } catch (Exception ex) { _logger.LogError(ex.Message); return(null); } return(JsonSerializer.Deserialize <CotizaciónDto>(response.Content.ReadAsStringAsync().Result, new JsonSerializerOptions() { PropertyNameCaseInsensitive = true })); ; }
/// <summary> /// Eliminar un cotización /// </summary> /// <param name="Cotización"></param> /// <returns></returns> public async Task <bool> EliminarAsync(CotizaciónDto Cotización) { HttpResponseMessage response; var elUri = $"{_MyStringUri}/Eliminar"; string json = JsonSerializer.Serialize(Cotización); try { response = await _consumirAPIService.DELETERequestAsync(elUri, json); } catch (Exception ex) { _logger.LogError(ex.Message); return(false); } return(true);; }