public async Task <ActionResult <PVContract> > GetPVByUrl(string pvUrl, PVType type = PVType.Original, bool getTitle = true) { if (string.IsNullOrEmpty(pvUrl)) { return(BadRequest()); } var result = await _pvParser.ParseByUrlAsync(pvUrl, getTitle, _permissionContext); if (!result.IsOk) { var msg = result.Exception.Message; return(BadRequest(msg)); } var contract = new PVContract(result, type); return(contract); }
public async Task <PVContract> GetPVByUrl(string pvUrl, PVType type = PVType.Original, bool getTitle = true) { if (string.IsNullOrEmpty(pvUrl)) { throw new HttpResponseException(HttpStatusCode.BadRequest); } var result = await pvParser.ParseByUrlAsync(pvUrl, getTitle, permissionContext); if (!result.IsOk) { var msg = result.Exception.Message; throw new HttpResponseException(new HttpResponseMessage(HttpStatusCode.BadRequest) { ReasonPhrase = msg, Content = new StringContent(msg) }); } var contract = new PVContract(result, type); return(contract); }