Пример #1
0
        public async Task <IActionResult> Delete(int id, MyDebit myDebit)
        {
            if (id != myDebit.Id)
            {
                return(RedirectToAction(nameof(Index)));
            }

            try
            {
                await _myDebitRepository.DeleteAsync(myDebit);

                return(RedirectToAction(nameof(Index)));
            }
            catch
            {
                return(View());
            }
        }
Пример #2
0
        public async Task <IActionResult> Create(MyDebit myDebt)
        {
            if (myDebt == null)
            {
                return(RedirectToAction(nameof(Index)));
            }

            try
            {
                myDebt.CreateAt = DateTime.Now;
                myDebt.UpdateAt = DateTime.Now;
                myDebt.Status   = true;
                await _myDebitRepository.AddAsync(myDebt);

                return(RedirectToAction(nameof(Index)));
            }
            catch
            {
                return(View());
            }
        }