示例#1
0
        public ActionResult Update(Ads ads)
        {
            var Id = HttpContext.Session.GetInt32("ıd");

            if (Id == null)
            {
                return(Redirect("~/Account/Login"));
            }



            _adsService.Update(ads);

            return(RedirectToAction("IlanEkle"));
        }
示例#2
0
        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)));
        }