public FleetModel AddNewCar(FleetModel car)
        {
            Fleet newCar = new Fleet
            {
                LicensePlate = car.licensePlate,
                ModelID      = car.modelID
            };

            DB.Fleets.Add(newCar);
            DB.SaveChanges();
            return(GetOneCar(newCar.CarID));
        }
Exemple #2
0
 public HttpResponseMessage GetOneCar(int id)
 {
     try
     {
         FleetModel car = logic.GetOneCar(id);
         return(Request.CreateResponse(HttpStatusCode.OK, car));
     }
     catch (Exception e)
     {
         return(Request.CreateResponse(HttpStatusCode.InternalServerError, ErrorHelper.GetError(e)));
     }
 }