コード例 #1
0
 public void active(long fiscal_year_id)
 {
     try
     {
         using (TransactionScope tx = new TransactionScope(TransactionScopeOption.Required))
         {
             FiscalYear fiscalYear = _fiscalYearRepo.getById(fiscal_year_id);
             if (fiscalYear == null)
             {
                 throw new ItemNotFoundException($"Fiscal Year With Id {fiscal_year_id} is not Found.");
             }
             FiscalYear oldFiscalYear = _fiscalYearRepo.getByCurrent();
             if (oldFiscalYear != null)
             {
                 oldFiscalYear.is_current = false;
                 _fiscalYearRepo.update(fiscalYear);
             }
             tx.Complete();
         }
     }
     catch (Exception)
     {
         throw;
     }
 }
コード例 #2
0
        public IActionResult edit(long FiscalYear_id)
        {
            try
            {
                var           fiscalYear = _fiscalYearRepository.getById(FiscalYear_id);
                FiscalYearDto dto        = _mapper.Map <FiscalYearDto>(fiscalYear);

                // RouteData.Values.Remove("FiscalYear_id");
                return(View(dto));
            }
            catch (Exception ex)
            {
                AlertHelper.setMessage(this, ex.Message, messageType.error);
                return(RedirectToAction("index"));
            }
        }