public ActionResult Edit(int id) { var model = Mapper.Map <AdvertisementViewModel>(_adsService.GetById(id, CurrentUserId)); model.IsAdmin = User.IsInRole(Constants.AdminRole); model.CompanyId = CurrentUserCompanyId; PopulateDropDownListAndKeys(model); return(View(model)); }
public ActionResult Update(int adsId) { var Id = HttpContext.Session.GetInt32("ıd"); if (Id == null) { return(Redirect("~/Account/Login")); } var model = new AdsUpdateViewModel { User = _userService.GetById(Convert.ToInt32(Id)), Ads = _adsService.GetById(adsId), AdsCategory = _categoryService.GetAll(), PetBreed = _petBreedService.GetAll(), PetType = _petTypeService.GetAll(), City = _cityService.GetAll(), Gender = _petGenderSerivce.GetAll() }; return(View(model)); }