Пример #1
0
        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));
        }
Пример #3
0
 public IViewComponentResult Invoke()
 {
     Ad = _repository.Get();
     return(View(Ad));
 }