Exemple #1
0
        public IHttpActionResult Create(Provider value)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            try
            {
                service.Create(value);
                return(CreatedAtRoute("Providers_Create", new { id = value.Id }, value));
            }
            catch (NotSupportedException)
            {
                return(BadRequest());
            }
            catch (UnauthorizedAccessException)
            {
                return(StatusCode(HttpStatusCode.Forbidden));
            }
            catch (KeyNotFoundException)
            {
                return(NotFound());
            }
        }