public ActionResult Create(Mobile 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 (mobileBL.Add(mobile) > 0)
         {
             ViewBag.message = "Successfull";
             return(RedirectToAction("MobileDetails"));
         }
         ViewBag.message = "falied";
     }
     return(View());
 }
Ejemplo n.º 2
0
        public ActionResult Create(Mobile mobile)
        {
            BrandRepository brandRepository = new BrandRepository();

            TempData["brand"] = new SelectList(brandRepository.ViewBrand(), "BrandID", "BrandName");
            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 (mobileBL.Add(mobile) > 0)
                {
                    ViewBag.message = "Successfull";
                    return(RedirectToAction("MobileDetails"));
                }
                ViewBag.message = "falied";
            }
            return(View());
        }