public bool DeleteUrl(int Id) { if (Id > 0) { try { var url = _urlDal.Get(x => x.Id == Id); Url delUrl = new Url() { Id = url.Id, Count = url.Count, iUrl = url.iUrl }; _urlDal.Delete(delUrl); return(true); } catch (Exception) { return(false); } } else { return(false); } }
public IHttpActionResult GetUrl([FromUri] string shortUrl) { try { Url url = urlService.Get(shortUrl); return(this.Ok(url)); } catch (Exception ex) { throw this.ThrowException(ex); } }
public IDataResult <Url> GetUrlById(int id) { return(new SuccessDataResult <Url>(_urlDal.Get(filter: p => p.Id == id))); }