Example #1
0
        public async Task <(int ResultAction, TagResponse UpdatedEntity)> UpdateTagAsync(int id, TagRequest tagRequest)
        {
            if (tagRequest == null)
            {
                return(-1, null);
            }
            var updateTag = new Tag()
            {
                Id = tagRequest.Id, Name = tagRequest.Name, Visible = tagRequest.Visible, EditedAt = DateTime.Now
            };

            var result = await _tagBaseServices.UpdateAsync(updateTag, x => x.Name, x => x.Visible, x => x.EditedAt).ConfigureAwait(false);

            return(result.ResultAction, new TagResponse {
                TagID = result.UpdatedEntity.Id, Name = result.UpdatedEntity.Name
            });
        }
Example #2
0
        public async Task <(int ResultAction, CategoryResponse UpdatedEntity)> UpdateCategoryAsync(int id, CategoryRequest categoryRequest)
        {
            if (categoryRequest == null)
            {
                return(-1, null);
            }
            var updateCategory = new Category()
            {
                Id = categoryRequest.Id, Name = categoryRequest.Name, Visible = categoryRequest.Visible, EditedAt = DateTime.Now
            };

            var result = await _categoryBaseServices.UpdateAsync(updateCategory, x => x.Name, x => x.Visible, x => x.EditedAt).ConfigureAwait(false);

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