Example #1
0
        public HttpResponseMessage UpdateVehicle(string vehicleNumber, VehicleModel vehicleModel)
        {
            try
            {
                if (vehicleModel == null)
                {
                    return(Request.CreateResponse(HttpStatusCode.BadRequest, "Data is null."));
                }
                if (!ModelState.IsValid)
                {
                    Errors errors = ErrorsHelper.GetErrors(ModelState);
                    return(Request.CreateResponse(HttpStatusCode.BadRequest, errors));
                }

                vehicleModel.vehicleNumber = vehicleNumber;
                VehicleModel updatedVehicle = vehicleRepository.UpdateVehicle(vehicleModel);
                return(Request.CreateResponse(HttpStatusCode.OK, updatedVehicle));
            }
            catch (Exception ex)
            {
                Errors errors = ErrorsHelper.GetErrors(ex);
                return(Request.CreateResponse(HttpStatusCode.InternalServerError, errors));
            }
        }
Example #2
0
 static public OleDbCommand AddVehicle(VehicleModel vehicleModel)
 {
     return(CreateOleDbCommand(vehicleModel, queryVehiclesPost));
 }
Example #3
0
 static public OleDbCommand UpdateVehicle(VehicleModel vehicleModel)
 {
     return(CreateOleDbCommand(vehicleModel, queryVehiclesUpdate));
 }
Example #4
0
 public ThreeObjectsModel(PersonModel person2, VehicleModel vehicle2, ApprovalModel approval2)
 {
     personModel   = person2;
     vehicleModel  = vehicle2;
     approvalModel = approval2;
 }