public IHttpActionResult Get(int id) { BaseUrl = Request.RequestUri.Scheme + "://" + Request.RequestUri.Host + ":" + Request.RequestUri.Port; var ad = adRepo.Get(id); if (ad == null) { return(StatusCode(HttpStatusCode.NoContent)); } ad.Links = ad.CreateLinks(BaseUrl); return(Ok(ad)); }
[Route("api/requestAd/{id}")] //deleting ad public IHttpActionResult Delete(int id) { var adr = adRepo.Get(id); adRepo.Delete(id); specRepo.Delete(adr.SpecId); addressRepo.Delete(adr.AddressId); return(StatusCode(HttpStatusCode.NoContent)); }
public IViewComponentResult Invoke() { Ad = _repository.Get(); return(View(Ad)); }