Пример #1
0
        public ActionResult Edit(int id)
        {
            AddMobiles addMobiles = new AddMobiles();

            mobiles = mobileBL.Edit(id);
            return(View(addMobiles));
        }
        public ActionResult Edit(int id)
        {
            BrandRepository            repository = new BrandRepository();
            IEnumerable <Entity.Brand> brand      = repository.ViewBrand();

            ViewBag.Brand = new SelectList(brand, "BrandID", "BrandName");

            Mobile editMobile = mobileBL.Edit(id);

            AddMobiles addMobile = AutoMapper.Mapper.Map <Mobile, AddMobiles>(editMobile);

            return(View(addMobile));
        }
Пример #3
0
        public ActionResult Update(AddMobiles addMobiles)
        {
            if (ModelState.IsValid)
            {
                Mobile mobile = new Mobile();
                mobile.Brand   = mobile.Brand;
                mobile.Model   = mobile.Model;
                mobile.Battery = mobile.Battery;
                mobile.RAM     = mobile.RAM;
                mobile.ROM     = mobile.ROM;
                mobile.Price   = mobile.Price;

                mobileBL.update(mobile);
            }
            return(View());
        }
        public ActionResult Edit(AddMobiles addMobiles)
        {
            MobileRespository repository = new MobileRespository();

            if (ModelState.IsValid)
            {
                Mobile mobile = AutoMapper.Mapper.Map <AddMobiles, Mobile>(addMobiles);
                repository.Update(mobile);
                return(RedirectToAction("MobileDetails", "Mobile"));
            }
            BrandRepository            brandRepository = new BrandRepository();
            IEnumerable <Entity.Brand> brand           = brandRepository.ViewBrand();

            ViewBag.Brand = new SelectList(brand, "BrandID", "BrandName");
            return(RedirectToAction("Edit"));
        }