Пример #1
0
        public ActionResult AddBicycle(BicycleAddForCreate newItem)
        {
            //validate the input
            if (!ModelState.IsValid)
            {
                return(View(newItem));
            }

            //process the inputted data from form
            var addedBike = m.BicycleAddNew(newItem);

            if (addedBike == null)
            {
                return(View(newItem));
            }
            else
            {
                return(RedirectToAction("Details", "Bicycles", new { id = addedBike.Id }));
            }
        }
Пример #2
0
        public ActionResult CreateBicycleThroughWO(BicycleAddForCreate newItem)
        {
            //validate the input
            if (!ModelState.IsValid)
            {
                // return View(newItem);
                return(PartialView("_CreateBicycle", newItem));
            }

            //process the inputted data from form
            var addedBike = m.BicycleAddNew(newItem);

            if (addedBike == null)
            {
                return(PartialView("_CreateBicycle"));
            }
            else
            {
                return(PartialView("_DetailsBicycle", addedBike));
            }
        }