Beispiel #1
0
        public ActionResult Delete(int id)
        {
            var result = BikeRepo.Delete(id);

            if (result.HasError)
            {
                TempData["Error"] = result.Message;
            }
            return(RedirectToAction("List"));
        }
Beispiel #2
0
        public ActionResult List(string key = "")
        {
            var result = BikeRepo.GetAll(key);

            if (TempData["Error"] != null)
            {
                ViewBag.Error = TempData["Error"];
            }
            return(View(result));
        }
Beispiel #3
0
        public ActionResult Edit(Bike_Details bikesDetails)
        {
            if (!ModelState.IsValid)
            {
                return(View(bikesDetails));
            }

            var result = BikeRepo.Save(bikesDetails);

            if (result.HasError)
            {
                ViewBag.Error = result.Message;
                return(View(bikesDetails));
            }

            return(RedirectToAction("List"));
        }
Beispiel #4
0
        public ActionResult Edit(int id)
        {
            var result = BikeRepo.GetByID(id);

            return(View(result.Data ?? new Bike_Details()));
        }