public Driver(Identity id , Name name , Code code , PhoneNumber phoneNumber , Status status , Address address , Day dateOfBirth , CardNumber cardNumber , Note note , Sex sex , Day startDate , Identity userID , VehicleTypeID vehicleTypeID ) { Id = id; Name = name; Code = code; PhoneNumber = phoneNumber; Status = status; Address = address; DoB = dateOfBirth; IDCardNumber = cardNumber; Note = note; Sex = sex; StartDate = startDate; UserID = userID; VehicleTypeIDs = vehicleTypeID; }
public Vehicle(string registration, string vin, string entranceDate, string vehicleType) { if (StringValidator.isStringEmptyOrNull(registration)) { throw new BusinessRuleValidationException(registration + " invalid: Vehicle Registration: can't be null or empty."); } if (StringValidator.isStringEmptyOrNull(vin)) { throw new BusinessRuleValidationException(vin + " invalid: Vehicle Identification Number: can't be null or empty."); } if (StringValidator.isStringEmptyOrNull(entranceDate)) { throw new BusinessRuleValidationException(entranceDate + " invalid: Entrance Date: can't be null or empty."); } if (StringValidator.isStringEmptyOrNull(vehicleType)) { throw new BusinessRuleValidationException(entranceDate + " invalid: Vehicle Type: can't be null or empty."); } this.Id = new VehicleID(Guid.NewGuid()); this.registration = new Registration(registration); this.vin = new VIN(vin); this.entranceDate = new VehicleEntranceDate(entranceDate); this.vehicleType = new VehicleTypeID(vehicleType); }
public ActionResult DeleteConfirmed(int id) { VehicleTypeID vehicleTypeID = db.VehicleTypeIDs.Find(id); db.VehicleTypeIDs.Remove(vehicleTypeID); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "VehicleTypeID1,Name")] VehicleTypeID vehicleTypeID) { if (ModelState.IsValid) { db.Entry(vehicleTypeID).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(vehicleTypeID)); }
public ActionResult Create([Bind(Include = "VehicleTypeID1,Name")] VehicleTypeID vehicleTypeID) { if (ModelState.IsValid) { db.VehicleTypeIDs.Add(vehicleTypeID); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(vehicleTypeID)); }
// GET: VehicleTypeIDs/Delete/5 public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } VehicleTypeID vehicleTypeID = db.VehicleTypeIDs.Find(id); if (vehicleTypeID == null) { return(HttpNotFound()); } return(View(vehicleTypeID)); }