Beispiel #1
0
        public ActionResult Index()
        {
            //var driverViewModel =new DriverViewModel();
            var model = _dbContext.MottoModels
                        .ToList()
                        .Select(g => MottoModelFactory.MottoEntityToViewModel(g));

            return(View(model));
            //return Json(new { data = drivers }, JsonRequestBehavior.AllowGet);
        }
Beispiel #2
0
        public async Task <ActionResult> Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            MottorModel motto = await _dbContext.MottoModels.FindAsync(id);

            if (motto == null)
            {
                return(HttpNotFound());
            }

            MottorModelViewModel mottoModelViewModel = MottoModelFactory.MottoEntityToViewModel(motto);

            return(PartialView("_Delete", mottoModelViewModel));
        }
Beispiel #3
0
        public async Task <ActionResult> Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }

            MottorModel driver = await _dbContext.MottoModels.FindAsync(id);

            if (driver == null)
            {
                return(HttpNotFound());
            }

            MottorModelViewModel driverViewModel = MottoModelFactory.MottoEntityToViewModel(driver);


            return(PartialView("_Edit", driverViewModel));
        }