public ActionResult Create(Mobile mobile) { MobileRespository mobiles = new MobileRespository(); ViewBag.Mobile = new SelectList(mobiles.Brand(), "BrandId", "BrandName"); mobiles.Add(mobile); return(RedirectToAction("")); }
public ActionResult Create_post() { Mobile mobile = new Mobile(); UpdateModel <Mobile>(mobile); MobileRespository.Add(mobile); TempData["Message"] = "Added"; return(RedirectToAction("MobileDetails")); }
public ActionResult Create_post(Mobile mobile) { Mobile mobiles = new Mobile(); 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; if (MobileRespository.Add(mobile) > 0) { ViewBag.message = "Successfull"; } ViewBag.message = "falied"; } return(View()); }
public int Add(Mobile mobile) { return(mobileRespository.Add(mobile)); }