コード例 #1
0
        public async Task Insert(AlimentCategory entity)
        {
            var queryParameters = new DynamicParameters();

            queryParameters.Add("@Id", entity.Id);
            queryParameters.Add("@Label", entity.Label);

            await Execute("InsertAlimentCategory", queryParameters);
        }
コード例 #2
0
        private async Task ProcessCategory(int row, int col, IList <AlimentCategory> categories)
        {
            string categoryLabel = GetCellValue(row, col);

            if (!string.IsNullOrEmpty(categoryLabel))
            {
                AlimentCategory category = Categories.FirstOrDefault(x => x.Label == categoryLabel);
                if (category == null)
                {
                    category = new AlimentCategory
                    {
                        Id    = Guid.NewGuid(),
                        Label = categoryLabel
                    };

                    Categories.Add(category);
                    await _alimentCategoryRepository.Insert(category);
                }

                categories.Add(category);
            }
        }