public ActionResult Update(Ads ads) { var Id = HttpContext.Session.GetInt32("ıd"); if (Id == null) { return(Redirect("~/Account/Login")); } _adsService.Update(ads); return(RedirectToAction("IlanEkle")); }
public ActionResult Edit(AdvertisementViewModel model) { if (model.UserId != CurrentUserId.ToString()) { return(new HttpUnauthorizedResult()); } ModelState.Remove(nameof(AdvertisementViewModel.Budget)); ModelState.Remove(nameof(AdvertisementViewModel.ClickPrice)); if (!ModelState.IsValid) { PopulateDropDownListAndKeys(model); return(View(model)); } var ad = Mapper.Map <Advertisement>(model); ad.CreatedByAdmin = User.IsInRole(Constants.AdminRole); _adsService.Update(ad); return(RedirectToAction(nameof(Index))); }