Ejemplo n.º 1
0
        public async Task <(int ResultAction, TagResponse AddedEntity)> AddTagAsync(TagRequest tag)
        {
            if (tag == null)
            {
                return(-1, null);
            }
            var addTag = new Tag()
            {
                Name = tag.Name, Visible = tag.Visible
            };

            var result = await _tagBaseServices.InsertAsync(addTag).ConfigureAwait(false);

            return(result.ResultAction, new TagResponse {
                TagID = result.AddedEntity.Id, Name = result.AddedEntity.Name
            });
        }
Ejemplo n.º 2
0
        public async Task <(int ResultAction, CategoryResponse AddedEntity)> AddCategoryAsync(CategoryRequest category)
        {
            if (category == null)
            {
                return(-1, null);
            }
            var addCategory = new Category()
            {
                Name = category.Name, Visible = category.Visible
            };

            var result = await _categoryBaseServices.InsertAsync(addCategory).ConfigureAwait(false);

            return(result.ResultAction, new CategoryResponse {
                CatID = result.AddedEntity.Id, Name = result.AddedEntity.Name
            });
        }