Пример #1
0
        public async Task <ActionResult <Drink> > GetById(int id)
        {
            try
            {
                var drinkService = new DrinkService();
                var result       = await drinkService.GetByIdAsync(id);

                if (result == null)
                {
                    return(this.NotFound());
                }

                return(this.Ok(result));
            }
            catch (System.Exception exception)
            {
                log.LogError(exception, string.Format("{0}: Error in {1}", System.DateTime.Now, System.Reflection.MethodBase.GetCurrentMethod().Name));
                return(this.StatusCode(500));
            }
        }