public ActionResult Update()
        {
            Mobile mobile = new Mobile();

            TryUpdateModel <Mobile>(mobile);
            MobileRespository.Update(mobile);
            return(RedirectToAction("MobileDetails"));
        }
        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"));
        }
示例#3
0
        public ActionResult Edit(Mobile mobile)
        {
            MobileRespository repository = new MobileRespository();

            if (ModelState.IsValid)
            {
                mobile.Brand   = mobile.Brand;
                mobile.Model   = mobile.Model;
                mobile.Battery = mobile.Battery;
                mobile.RAM     = mobile.RAM;
                mobile.ROM     = mobile.ROM;
                mobile.Price   = mobile.Price;
                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"));
        }
示例#4
0
 public void update(Mobile mobile)
 {
     mobileRespository.Update(mobile);
 }