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")); }
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")); }
public void update(Mobile mobile) { mobileRespository.Update(mobile); }