public Response <Car> FetchOneCarById(int CarID)
        {
            Response <Car> res = new Response <Car>();

            try
            {
                using (var carBusiness = new CarBusiness())
                {
                    res = carBusiness.FetchCarById(CarID);
                }
            }
            catch (Exception ex)
            {
                res.isSuccess = false;
                res.Message   = "An error occured in CarService.FetchOneCarById \n" + ex.Message;
            }
            return(res);
        }
Exemple #2
0
        // GET: api/Car/id
        // url parameter = id of the needed car
        // brings car with given car id
        // SOAP Name = FetchOneCarById
        public IHttpActionResult Get(int id)
        {
            var content = new Response <Car>();

            try
            {
                using (var carBusines = new CarBusiness())
                {
                    content = carBusines.FetchCarById(id);
                }
            }
            catch (Exception ex)
            {
                content.isSuccess = false;
                content.Message  += ex.Message;
            }
            return(new StandartResult <Car>(content, Request));
        }