Ejemplo n.º 1
0
        public HttpResponseMessage Post([FromBody] CarEntity CarEntity)
        {
            string Username;
            bool   IsDealer;

            if (IsAdminOrDealer(out Username, out IsDealer))
            {
                return(Request.CreateResponse(HttpStatusCode.OK, _carServices.CreateCarByDealer(CarEntity, Username)));
            }
            else
            {
                return(Request.CreateErrorResponse(HttpStatusCode.Unauthorized, "Only Admin and Dealer can perform this action"));
            }
        }