예제 #1
0
        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));
        }
예제 #2
0
        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));
        }