Пример #1
0
        public void EditVehicleModel(ViewVehicleModel viewVehicleModel)
        {
            VehicleModel vehicleModels = Db.VehicleModels.Find(viewVehicleModel.VehicleModelId);

            Mapper.Map(viewVehicleModel, vehicleModels);
            Db.SaveChanges();
        }
 public ActionResult Edit([Bind(Include = "VehicleModelId,VehicleMakeId,VehicleModelName,VehicleModelAbrv")] ViewVehicleModel vehicleModel)
 {
     if (ModelState.IsValid)
     {
         vehicleservice.EditVehicleModel(vehicleModel);
         return(RedirectToAction("Index"));
     }
     ViewBag.VehicleMakeId = vehicleservice.getAll();
     return(View(vehicleModel));
 }
        public ActionResult Create([Bind(Include = "VehicleModelId,VehicleMakeId,VehicleModelName,VehicleModelAbrv")] ViewVehicleModel vehicleModel)
        {
            if (ModelState.IsValid)
            {
                //vehicleModel.VehicleMakeId = 4;
                vehicleservice.CreateVehicleModel(vehicleModel);
                return(RedirectToAction("Index"));
            }

            ViewBag.VehicleMakeId = vehicleservice.getAll().ToList();
            return(View(vehicleModel));
        }
        // GET: VehicleModels/Details/5
        public ActionResult Details(Guid?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            ViewVehicleModel vehicleModel = vehicleservice.FindVehicleModel(id);

            if (vehicleModel == null)
            {
                return(HttpNotFound());
            }
            return(View(vehicleModel));
        }
        // GET: VehicleModels/Edit/5
        public ActionResult Edit(Guid?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            ViewVehicleModel vehicleModel = vehicleservice.FindVehicleModel(id);

            if (vehicleModel == null)
            {
                return(HttpNotFound());
            }
            ViewBag.VehicleMakeId = vehicleservice.getAll();
            return(View(vehicleModel));
        }
Пример #6
0
 public void CreateVehicleModel(ViewVehicleModel vehicleModel)
 {
     Db.VehicleModels.Add(Mapper.Map <VehicleModel>(vehicleModel));
     Db.SaveChanges();
 }