コード例 #1
0
ファイル: BilController.cs プロジェクト: aspcodenet/SPOBil
        public ActionResult View(int id)
        {
            var db    = new Models.DBContext();
            var bil   = db.Get(id);
            var model = new ViewModels.BilViewViewModel
            {
                Color        = bil.Color,
                Manufacturer = bil.Manufacturer,
                Model        = bil.Model,
                Price        = bil.Price,
                Year         = bil.Year
            };

            return(View(model));
        }
コード例 #2
0
ファイル: BilController.cs プロジェクト: aspcodenet/SPOBil
        public ActionResult Edit(ViewModels.BilEditViewModel model)
        {
            if (!ModelState.IsValid)
            {
                return(View(model));
            }
            var db  = new Models.DBContext();
            var bil = db.Get(model.Id);

            bil.Manufacturer = model.Manufacturer;
            bil.Model        = model.Modell;
            //bil.Price = model.Price;
            bil.Year  = model.Year;
            bil.Color = model.Color;

            return(RedirectToAction("Index"));
        }