Example #1
0
        public async Task <IActionResult> OnGetAsync(int?id)
        {
            if (id == null)
            {
                return(BadRequest());
            }

            var transactionToModify = await _context.TransactorTransactions
                                      .Include(t => t.Company)
                                      .Include(t => t.FiscalPeriod)
                                      .Include(t => t.Section)
                                      .Include(t => t.TransTransactorDocSeries)
                                      .Include(t => t.TransTransactorDocType)
                                      .Include(t => t.Transactor)
                                      .FirstOrDefaultAsync(m => m.Id == id);

            if (transactionToModify == null)
            {
                return(NotFound());
            }
            ItemVm       = _mapper.Map <TransactorTransModifyDto>(transactionToModify);
            NotUpdatable = ItemVm.CreatorId != 0;
            LoadCombos();
            return(Page());
        }
Example #2
0
        public async Task <IActionResult> OnGetAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            var transactionToModify = await _context.TransactorTransactions
                                      .Include(t => t.Company)
                                      .Include(t => t.FiscalPeriod)
                                      .Include(t => t.Section)
                                      .Include(t => t.TransTransactorDocSeries)
                                      .Include(t => t.TransTransactorDocType)
                                      .Include(t => t.Transactor).FirstOrDefaultAsync(m => m.Id == id);

            if (transactionToModify == null)
            {
                return(NotFound());
            }

            var section = _context.Sections.SingleOrDefault(s => s.SystemName == _sectionCode);

            if (section is null)
            {
                _toastNotification.AddAlertToastMessage("Supplier Transactions section not found in DB");
                return(BadRequest());
            }
            //If section is not our section the canot update disable input controls
            NotUpdatable = transactionToModify.SectionId != section.Id;

            ItemVm = _mapper.Map <TransactorTransModifyDto>(transactionToModify);
            LoadCombos();
            return(Page());
        }