public ActionResult DeleteConfirmed(int id)
        {
            PropulsionType propulsiontype = db.PropulsionTypes.Find(id);

            db.PropulsionTypes.Remove(propulsiontype);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
 public ActionResult Edit([Bind(Include = "ID,PropulsionType1")] PropulsionType propulsiontype)
 {
     if (ModelState.IsValid)
     {
         db.Entry(propulsiontype).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(propulsiontype));
 }
        public ActionResult Create([Bind(Include = "ID,PropulsionType1")] PropulsionType propulsiontype)
        {
            if (ModelState.IsValid)
            {
                db.PropulsionTypes.Add(propulsiontype);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(propulsiontype));
        }
        // GET: /PropulsionType/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            PropulsionType propulsiontype = db.PropulsionTypes.Find(id);

            if (propulsiontype == null)
            {
                return(HttpNotFound());
            }
            return(View(propulsiontype));
        }
Ejemplo n.º 5
0
 public VehicleTypes(
     [JsonProperty("vehicle_type_id")] string id,
     [JsonProperty("form_factor"), JsonConverter(typeof(StringEnumConverter))] VehicleFormFactor vehicleFormFactor,
     [JsonProperty("propulsion_type"), JsonConverter(typeof(StringEnumConverter))] PropulsionType propulsionType,
     [JsonProperty("max_range_meters")] long maxRangeMeters,
     [JsonProperty("name"), JsonConverter(typeof(TrimmingConverter))] string name
     )
 {
     Id = id;
     VehicleFormFactor = vehicleFormFactor;
     PropulsionType    = propulsionType;
     MaxRangeMeters    = maxRangeMeters;
     Name = string.IsNullOrEmpty(name) ? Id : name;
 }