public ActionResult details(int id) { var annonce = annoncesRepository.GetById(id); if (annonce == null) { throw new HttpException(404, "Annonce not found"); } return(View(annonce)); }
public ActionResult Modifier(int id) { tb_ads ad = annoncesRepository.GetById(id); if (ad == null) { throw new HttpException(404, "Annonce not found"); } ModifierAdsViewModel model = new ModifierAdsViewModel { id_ad = ad.id_ad, ad_title = ad.ad_title, id_section = ad.id_section, id_category = ad.id_category, ad_description = ad.ad_description, ad_price = (double)ad.ad_price, id_devise = (int)ad.id_devise }; ViewBag.id_devise = new SelectList(deviseRepository.GetAll(), "id_devise", "description", model.id_devise); ViewBag.selected_category = this.populateCategoryBySection(); return(View(model)); }
public IHttpActionResult details(int id) { try { var ads = _annonceRepository.GetById(id); var model = _modelFactory.Create(ads); return(Ok(model)); } catch (Exception ex) { //Logging return(InternalServerError(ex)); } }