public Response <Car> AddNewCar(Car entity)
        {
            Response <Car> res = new Response <Car>();

            try
            {
                using (var carBusiness = new CarBusiness())
                {
                    res = carBusiness.AddNewCar(entity);
                }
            }
            catch (Exception ex)
            {
                res.isSuccess = false;
                res.Message   = "An error occured in CarService.AddNewCar \n" + ex.Message;
            }
            return(res);
        }
Ejemplo n.º 2
0
        // POST: api/Car
        // body = Car object
        // adds a new car
        // SOAP Name = AddNewCar
        public IHttpActionResult Post([FromBody] Car car)
        {
            var content = new Response <Car>();

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