Пример #1
0
        public async Task <IActionResult> Get(int?id)
        {
            if (id == null)
            {
                return(BadRequest());
            }

            try
            {
                var customer = await customers.GetCustomer(id);

                if (customer == null)
                {
                    return(NotFound(new { Id = id, error = "There was no customer with an id of " + id + "." }));
                }
                else
                {
                    return(Ok(customer));
                }
            }
            catch (Exception)
            {
                return(BadRequest());
            }
        }
 public async Task <Customer> Details(int id)
 {
     return(await customers.GetCustomer(id));
 }