Esempio n. 1
0
        public async Task AddAsync(vm.Category category)
        {
            dm.Category dmCategory = _mapper.Map <dm.Category>(category);
            await _unitOfWork.CategoryData.AddAsync(dmCategory);

            await _unitOfWork.SaveChangesAsync();
        }
Esempio n. 2
0
        public async Task <bool> UpdateAsync(vm.Category category)
        {
            var dmCategory = await _unitOfWork.CategoryData.GetCategoryAsync(category.Id);

            if (dmCategory != null)
            {
                dmCategory.Name = category.Name;
                await _unitOfWork.SaveChangesAsync();

                return(true);
            }
            return(false);
        }