Пример #1
0
        public async Task <DebtView> Delete(int id)
        {
            var reg = await Context.Debts.FindAsync(id);

            reg.Cancel();

            await Context.SaveChangesAsync();

            return(DebtView.New(reg));
        }
Пример #2
0
        public async Task <DebtView> Update(int id, DebtDto dto)
        {
            var reg = await Context.Debts.FindAsync(id);

            _debtMapper.Map(reg, dto);

            _customerValidator.Validate(reg);

            await Context.SaveChangesAsync();

            return(DebtView.New(reg));
        }
Пример #3
0
        public async Task <DebtView> Insert(DebtDto dto)
        {
            var reg = new Debt();

            _debtMapper.Map(reg, dto);

            _customerValidator.Validate(reg);

            await Context.Debts.AddAsync(reg);

            await Context.SaveChangesAsync();

            return(DebtView.New(reg));
        }