예제 #1
0
        public IHttpActionResult Get([FromODataUri] int key)
        {
            DeltaEnumCustomer customer = GetCustomers().FirstOrDefault(e => e.Id == key);

            if (customer != null)
            {
                return(Ok(customer));
            }
            else
            {
                return(NotFound());
            }
        }
예제 #2
0
        public IHttpActionResult Patch([FromODataUri] int key, Delta <DeltaEnumCustomer> patch)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            DeltaEnumCustomer customer = GetCustomers().FirstOrDefault(e => e.Id == key);

            if (customer == null)
            {
                return(NotFound());
            }

            patch.Patch(customer);
            return(Updated(customer));
        }