Example #1
0
        public async Task <ReqResult> AddNewItem(ItemDTO item)
        {
            var payload = _mapper.Map <Item>(item);
            await _context.AddAsync(payload);

            await _context.SaveChangesAsync();

            return(ReqResult.Success);
        }
Example #2
0
        public async Task <Category> AddNewCategory(CategoryDTO newCategory)
        {
            var dbInsertPayload = _mapper.Map <Category>(newCategory);

            await _context.AddAsync(dbInsertPayload);

            await _context.SaveChangesAsync();

            return(dbInsertPayload);
        }