Пример #1
0
        private static string GetCategoryName(int id)
        {
            IRepository<Category> categoryRepo = new MongoRepository<Category>();

            Category category = categoryRepo.GetOne(x => x.Id == id).Result;

            if (category != null)
            {
                return string.Empty;
            }

            return category.Name;
        }
        private async Task<string> GetCategoryName(int id)
        {
            if(id == 0)
            {
                return string.Empty;
            }
            IRepository<Category> categoryRepo = new MongoRepository<Category>();

            Category category = await categoryRepo.GetOne(x => x.Id == id);
            
            return category.Name;
        }