Example #1
0
 public void Delete(int id)
 {
     var vehicle = new VehicleDa(databasecontext);
     if (id > 0)
     {
         var currentVehicle = GetById(id);
         vehicle.Delete(currentVehicle);
     }
 }
Example #2
0
        public Vehicle Save(int id, string Name, string RegistrationNumber)
        {
            var vehicle = id > 0 ? GetById(id) : new Vehicle();

            vehicle.Name = Name;
            vehicle.RegistrationNumber = RegistrationNumber;

            var vehicleDa = new VehicleDa(databasecontext);

            //if new
            if (id < 1) vehicle = vehicleDa.Add(vehicle);
            //update
            else vehicle = vehicleDa.Update(vehicle);
            return vehicle;
        }