コード例 #1
0
 public async Task <IActionResult> Edit(ClaimDocumentViewModel viewModel)
 {
     if (ModelState.IsValid)
     {
         ClaimDocument claimDocument = new ClaimDocument();
         claimDocument = viewModel.ClaimDocument;
         try
         {
             _context.Update(claimDocument);
             await _context.SaveChangesAsync();
         }
         catch (DbUpdateConcurrencyException)
         {
             if (!ClaimDocumentExists(claimDocument.ID))
             {
                 return(NotFound());
             }
             else
             {
                 throw;
             }
         }
         return(RedirectToAction("Index"));
     }
     return(View(viewModel));
 }
コード例 #2
0
ファイル: LoansController.cs プロジェクト: levinkata/isas
        public async Task <IActionResult> Edit(Guid id, [Bind("ID,AccountNumber,ComponentID,EndDate,LoanDate,PolicyID,Premium,Rate,SettlementDate,StartDate,Term,Value")] Loan loan)
        {
            if (id != loan.ID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(loan);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!LoanExists(loan.ID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction("Index"));
            }
            ViewData["ComponentID"] = new SelectList(_context.Components, "ID", "Name", loan.ComponentID);
            ViewData["PolicyID"]    = new SelectList(_context.Policies, "ID", "PolicyNumber", loan.PolicyID);
            return(View(loan));
        }
コード例 #3
0
        public async Task <IActionResult> Edit(Guid id, [Bind("ID,Description,Name")] Region region)
        {
            if (id != region.ID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(region);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!RegionExists(region.ID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction("Index"));
            }
            return(View(region));
        }
コード例 #4
0
 public async Task <IActionResult> Edit(FormatTypeViewModel viewModel)
 {
     if (ModelState.IsValid)
     {
         FormatType formatType = new FormatType();
         formatType = viewModel.FormatType;
         try
         {
             _context.Update(formatType);
             await _context.SaveChangesAsync();
         }
         catch (DbUpdateConcurrencyException)
         {
             if (!FormatTypeExists(formatType.ID))
             {
                 return(NotFound());
             }
             else
             {
                 throw;
             }
         }
         return(RedirectToAction("EditFormatType", "LoadFormats", new { productId = viewModel.ProductID, loadFormatId = formatType.LoadFormatID,
                                                                        tableName = formatType.TableName, uploadFileType = viewModel.UploadFileType }));
     }
     return(View(viewModel));
 }
コード例 #5
0
        public async Task <IActionResult> Edit(Guid id, [Bind("ID,DialingCode,ISOCode,ISOCurrency,Name,Tax")] Country country)
        {
            if (id != country.ID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(country);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!CountryExists(country.ID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction("Index"));
            }
            return(View(country));
        }
コード例 #6
0
ファイル: AddressesController.cs プロジェクト: levinkata/isas
 public async Task <IActionResult> Edit(AddressViewModel viewModel)
 {
     if (ModelState.IsValid)
     {
         Address address = new Address();
         address = viewModel.Address;
         try
         {
             _context.Update(address);
             await _context.SaveChangesAsync();
         }
         catch (DbUpdateConcurrencyException)
         {
             if (!AddressExists(address.ID))
             {
                 return(NotFound());
             }
             else
             {
                 throw;
             }
         }
         return(RedirectToAction("Index", new { itemId = viewModel.ItemID }));
     }
     return(View(viewModel));
 }
コード例 #7
0
ファイル: InvoicesController.cs プロジェクト: levinkata/isas
        public async Task <IActionResult> Edit(int id, [Bind("ID,PolicyID,InvoiceDate,Status")] Invoice invoice)
        {
            if (id != invoice.InvoiceNumber)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(invoice);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!InvoiceExists(invoice.InvoiceNumber))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction("Index"));
            }
            return(View(invoice));
        }
コード例 #8
0
        public async Task <IActionResult> Edit(Guid id, [Bind("ID,AccountCode,Description,IncomeOrExpense")] AccountChart accountChart)
        {
            if (id != accountChart.ID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(accountChart);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!AccountChartExists(accountChart.ID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction("Index"));
            }
            return(View(accountChart));
        }
コード例 #9
0
        public async Task <IActionResult> Edit(ClaimTransactionViewModel viewModel)
        {
            if (ModelState.IsValid)
            {
                ClaimTransaction claimTransaction = new ClaimTransaction();
                claimTransaction           = viewModel.ClaimTransaction;
                claimTransaction.TaxAmount = TaxAmount(claimTransaction.Taxable, claimTransaction.Amount, claimTransaction.ClaimNumber);

                try
                {
                    _context.Update(claimTransaction);
                    await _context.SaveChangesAsync();

                    return(RedirectToAction("Index", new { claimId = claimTransaction.ClaimNumber }));
                }
                catch (DbUpdateException ex)
                {
                    ModelState.AddModelError(string.Empty, ex.InnerException.Message.ToString());
                }
            }
            viewModel.AccountList         = new SelectList(_context.AccountCharts, "ID", "AccountCode", viewModel.ClaimTransaction.AccountID);
            viewModel.AffectedList        = new SelectList(_context.Affecteds, "ID", "Name", viewModel.ClaimTransaction.AffectedID);
            viewModel.PayeeList           = new SelectList(_context.Payees, "ID", "Name", viewModel.ClaimTransaction.PayeeID);
            viewModel.TransactionTypeList = new SelectList(_context.TransactionTypes, "ID", "Name", viewModel.ClaimTransaction.TransactionTypeID);
            return(View(viewModel));
        }
コード例 #10
0
ファイル: WallTypesController.cs プロジェクト: levinkata/isas
        public async Task <IActionResult> Edit(Guid id, [Bind("ID,Name")] WallType wallType)
        {
            if (id != wallType.ID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(wallType);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!WallTypeExists(wallType.ID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction("Index"));
            }
            return(View(wallType));
        }
コード例 #11
0
        public async Task <IActionResult> Edit(int id, [Bind("BulkNumber,AddedBy,BulkDate,DateAdded,RecordCount,TableName")] BulkHandleGenerator bulkHandleGenerator)
        {
            if (id != bulkHandleGenerator.BulkNumber)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(bulkHandleGenerator);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!BulkHandleGeneratorExists(bulkHandleGenerator.BulkNumber))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction("Index"));
            }
            return(View(bulkHandleGenerator));
        }
コード例 #12
0
        public async Task <IActionResult> Edit(ThirdPartyViewModel viewModel)
        {
            if (ModelState.IsValid)
            {
                try
                {
                    ThirdParty thirdParty = viewModel.ThirdParty;
                    _context.Update(thirdParty);
                    await _context.SaveChangesAsync();

                    var FullName    = (thirdParty.FirstName == null) ? thirdParty.LastName : thirdParty.FirstName + ' ' + thirdParty.LastName;
                    var payeeParams = new object[] { thirdParty.ID, FullName };
                    await _context.Database.ExecuteSqlCommandAsync(
                        "UPDATE Payee SET Name = {0} WHERE PayeeItemID = {1}",
                        parameters : payeeParams);

                    return(RedirectToAction("Index", new { payeeclassId = viewModel.ThirdParty.PayeeClassID }));
                }
                catch (DbUpdateException ex)
                {
                    var errorMsg = ex.InnerException.Message.ToString();

                    viewModel.ErrMsg = errorMsg;
                    ModelState.AddModelError(string.Empty, viewModel.ErrMsg);
                }
            }
            return(View(viewModel));
        }
コード例 #13
0
        public async Task <IActionResult> Edit(Guid id, [Bind("ID,PolicyID,ComponentID,Description,Motor,Rate,Value,Premium,StartDate,EndDate,DateAdded,AddedBy,DateModified,ModifiedBy")] Commercial commercial)
        {
            if (id != commercial.ID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(commercial);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!CommercialExists(commercial.ID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction("Index"));
            }
            ViewData["ComponentID"] = new SelectList(_context.Components, "ID", "Name", commercial.ComponentID);
            ViewData["PolicyID"]    = new SelectList(_context.Policies, "ID", "ID", commercial.PolicyID);
            return(View(commercial));
        }
コード例 #14
0
ファイル: PayeesController.cs プロジェクト: levinkata/isas
        public async Task <IActionResult> Edit(Guid id, [Bind("ID,PayeeClassID,PayeeItemID")] Payee payee)
        {
            if (id != payee.ID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(payee);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!PayeeExists(payee.ID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction("Index"));
            }
            ViewData["PayeeClassID"] = new SelectList(_context.PayeeClasses, "ID", "Name", payee.PayeeClassID);
            return(View(payee));
        }
コード例 #15
0
ファイル: InsurersController.cs プロジェクト: levinkata/isas
        public async Task <IActionResult> Edit(InsurerViewModel viewModel)
        {
            if (ModelState.IsValid)
            {
                try
                {
                    Insurer insurer = new Insurer();
                    insurer = viewModel.Insurer;
                    _context.Update(insurer);
                    await _context.SaveChangesAsync();

                    var payeeParams = new object[] { insurer.ID, insurer.Name };
                    await _context.Database.ExecuteSqlCommandAsync(
                        "UPDATE Payee SET Name = {0} WHERE PayeeItemID = {1}",
                        parameters : payeeParams);

                    return(RedirectToAction("Index", new { payeeclassId = viewModel.Insurer.PayeeClassID }));
                }
                catch (DbUpdateException ex)
                {
                    var errorMsg = ex.InnerException.Message.ToString();

                    viewModel.ErrMsg = errorMsg;
                    ModelState.AddModelError(string.Empty, viewModel.ErrMsg);
                }
            }
            return(View(viewModel));
        }
コード例 #16
0
        public async Task <IActionResult> Edit(Guid id, [Bind("ID,BondHolder,CoverageID,EndDate,Location,PolicyID,Premium,ResidenceTypeID,RoofTypeID,StartDate,Value,WallTypeID")] Property @property)
        {
            if (id != @property.ID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(@property);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!PropertyExists(@property.ID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction("Index"));
            }
            ViewData["CoverageID"]      = new SelectList(_context.Coverages, "ID", "Name", @property.CoverageID);
            ViewData["PolicyID"]        = new SelectList(_context.Policies, "ID", "PolicyNumber", @property.PolicyID);
            ViewData["ResidenceTypeID"] = new SelectList(_context.ResidenceTypes, "ID", "Name", @property.ResidenceTypeID);
            ViewData["RoofTypeID"]      = new SelectList(_context.RoofTypes, "ID", "Name", @property.RoofTypeID);
            ViewData["WallTypeID"]      = new SelectList(_context.WallTypes, "ID", "Name", @property.WallTypeID);
            return(View(@property));
        }
コード例 #17
0
ファイル: AllRisksController.cs プロジェクト: levinkata/isas
 public async Task <IActionResult> Edit(Guid id, AllRiskViewModel viewModel)
 {
     if (ModelState.IsValid)
     {
         AllRisk allRisk = viewModel.AllRisk;
         try
         {
             _context.Update(allRisk);
             await _context.SaveChangesAsync();
         }
         catch (DbUpdateConcurrencyException)
         {
             if (!AllRiskExists(allRisk.ID))
             {
                 return(NotFound());
             }
             else
             {
                 throw;
             }
         }
         return(RedirectToAction("Index", new { policyid = allRisk.PolicyID }));
     }
     return(View(viewModel));
 }
コード例 #18
0
ファイル: RisksController.cs プロジェクト: levinkata/isas
 public async Task <IActionResult> Edit(RiskViewModel viewModel)
 {
     if (ModelState.IsValid)
     {
         Risk risk = viewModel.Risk;
         try
         {
             _context.Update(risk);
             await _context.SaveChangesAsync();
         }
         catch (DbUpdateConcurrencyException)
         {
             if (!RiskExists(risk.ID))
             {
                 return(NotFound());
             }
             else
             {
                 throw;
             }
         }
         return(RedirectToAction("Index"));
     }
     return(View(viewModel));
 }
コード例 #19
0
ファイル: PayablesController.cs プロジェクト: levinkata/isas
        public async Task <IActionResult> Edit(Guid id, [Bind("ID,Reference,PayableDate,PaymentTypeID,Amount,BatchNumber,Void,VoidReason,Remarks,PayableExportID")] Payable payable)
        {
            if (id != payable.ID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(payable);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!PayableExists(payable.ID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction("Index"));
            }
            ViewData["PayableExportID"] = new SelectList(_context.PayableExports, "ID", "Name", payable.PayableExportID);
            return(View(payable));
        }
コード例 #20
0
        public async Task <IActionResult> Edit(Guid id, [Bind("ID,IsUpdatable,Name")] PolicyStatus policyStatus)
        {
            if (id != policyStatus.ID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(policyStatus);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!PolicyStatusExists(policyStatus.ID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction("Index"));
            }
            return(View(policyStatus));
        }
コード例 #21
0
        public async Task <IActionResult> Edit(Guid id, [Bind("ID,BIC,BankID,Name,SwiftCode")] BankBranch bankBranch)
        {
            if (id != bankBranch.ID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(bankBranch);
                    await _context.SaveChangesAsync();

                    return(RedirectToAction("Index", new { bankid = bankBranch.BankID }));
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!BankBranchExists(bankBranch.ID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
            }
            ViewData["BankID"] = bankBranch.BankID;
            return(View(bankBranch));
        }
コード例 #22
0
        public async Task <IActionResult> Edit(Guid id, [Bind("ID,MotorMakeID,Name")] MotorModel motorModel)
        {
            if (id != motorModel.ID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(motorModel);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!MotorModelExists(motorModel.ID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction("Index", new { motormakeid = motorModel.MotorMakeID }));
            }
            ViewData["MotorMakeID"] = motorModel.MotorMakeID;
            return(View(motorModel));
        }
コード例 #23
0
        public async Task <IActionResult> Edit(ContainerViewModel viewModel)
        {
            if (ModelState.IsValid)
            {
                try
                {
                    Container container = new Container();
                    container              = viewModel.Container;
                    container.ModifiedBy   = Guid.Parse(User.FindFirstValue(ClaimTypes.NameIdentifier));
                    container.DateModified = DateTime.Now;
                    _context.Update(container);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    //Log the error (uncomment ex variable name and write a log.
                    ModelState.AddModelError("", "Unable to save changes. " +
                                             "Try again, and if the problem persists " +
                                             "see your system administrator.");
                }
                return(RedirectToAction(nameof(Index)));
            }

            viewModel.CountryList = new SelectList(await _context.Countries.OrderBy(c => c.Name).ToListAsync(),
                                                   "ID", "Name", viewModel.Container.CountryID);
            return(View(viewModel));
        }
コード例 #24
0
 public async Task <IActionResult> Edit(ClaimViewModel viewModel)
 {
     if (ModelState.IsValid)
     {
         try
         {
             Models.Claim claim = new Models.Claim();
             claim = viewModel.Claim;
             _context.Update(claim);
             await _context.SaveChangesAsync();
         }
         catch (DbUpdateConcurrencyException)
         {
             if (!ClaimExists(viewModel.Claim.ClaimNumber))
             {
                 return(NotFound());
             }
             else
             {
                 throw;
             }
         }
         return(RedirectToAction("Index", new { policyId = viewModel.Claim.PolicyID }));
     }
     viewModel.ClaimClassList  = new SelectList(_context.ClaimClasses, "ID", "Name", viewModel.Claim.ClaimClassID);
     viewModel.ClaimStatusList = new SelectList(_context.ClaimStatuses, "ID", "Name", viewModel.Claim.ClaimStatusID);
     viewModel.IncidentList    = new SelectList(_context.Incidents, "ID", "Name", viewModel.Claim.IncidentID);
     viewModel.RegionList      = new SelectList(_context.Regions, "ID", "Name", viewModel.Claim.RegionID);
     return(View(viewModel));
 }
コード例 #25
0
ファイル: PremiumsController.cs プロジェクト: levinkata/isas
        public async Task <IActionResult> Edit(PremiumViewModel viewModel)
        {
            if (ModelState.IsValid)
            {
                try
                {
                    Premium premium = new Premium();
                    premium = viewModel.Premium;

                    //  Calculate Policy Fee, Commission and Admin Fee using currentproductId
                    List <decimal> BrokerCharges = GetBrokerCharges(viewModel.ProductID, premium.RiskID, premium.Amount);
                    premium.PolicyFee  = BrokerCharges[0];
                    premium.Commission = BrokerCharges[1];
                    premium.AdminFee   = BrokerCharges[2];

                    _context.Update(premium);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateException ex)
                {
                    var errorMsg = ex.InnerException.Message.ToString();

                    viewModel.ErrMsg = errorMsg;
                    ModelState.AddModelError(string.Empty, viewModel.ErrMsg);
                }
                return(RedirectToAction("Index", new
                {
                    productId = viewModel.ProductID,
                    clientId = viewModel.ClientID,
                    policyId = viewModel.PolicyID
                }));
            }
            viewModel.PremiumTypeList = new SelectList(await _context.PremiumTypes.AsNoTracking().OrderBy(p => p.Name).ToListAsync(),
                                                       "ID", "Name", viewModel.Premium.PremiumTypeID);
            return(View(viewModel));
        }
コード例 #26
0
        public async Task <IActionResult> Edit(Guid id, [Bind("ID,CFG,ChassisNumber,CoverageID,DriverTypeID,EndDate,EngineNumber,HasAlarm,HasImmobiliser,IsBusinessUse,IsGreyImport,IsPrivateUse,ManufacturerYear,MotorMakeID,MotorModelID,MotorTypeID,PolicyID,Premium,RegistrationNumber,StartDate,TerritorialLimit,Value")] Motor motor)
        {
            if (id != motor.ID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(motor);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!MotorExists(motor.ID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction("Index"));
                //            return RedirectToAction("PolicyRisks", "Policies",
                //                      new { productId = viewModel.ProductID, clientId = viewModel.ClientID, policyId = viewModel.PolicyID });
            }
            ViewData["CoverageID"]   = new SelectList(_context.Coverages, "ID", "Name", motor.CoverageID);
            ViewData["DriverTypeID"] = new SelectList(_context.DriverTypes, "ID", "Name", motor.DriverTypeID);
            ViewData["MotorMakeID"]  = new SelectList(_context.MotorMakes, "ID", "Name", motor.MotorMakeID);
            ViewData["MotorTypeID"]  = new SelectList(_context.MotorTypes, "ID", "Name", motor.MotorTypeID);
            ViewData["PolicyID"]     = new SelectList(_context.Policies, "ID", "PolicyNumber", motor.PolicyID);
            return(View(motor));
        }
コード例 #27
0
        public async Task <IActionResult> Edit(LoadFormatViewModel viewModel)
        {
            FileTypes[] values = (FileTypes[])Enum.GetValues(typeof(FileTypes));

            var list = (from value in values
                        select new SelectListItem()
            {
                Value = ((int)value).ToString(),
                Text = value.ToString()
            }).ToList();

            if (ModelState.IsValid)
            {
                LoadFormat loadFormat = new LoadFormat();
                loadFormat = viewModel.LoadFormat;
                try
                {
                    _context.Update(loadFormat);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!LoadFormatExists(loadFormat.ID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction("Index", new { productId = loadFormat.ProductID }));
            }
            viewModel.FileTypeList = new SelectList(list, "Value", "Text", viewModel.LoadFormat.UploadFileType);
            return(View(viewModel));
        }
コード例 #28
0
 public ActionResult CellEditUpdate([FromBody] CRUDModel <Client> client)
 {
     _context.Update(client.Value);
     _context.SaveChanges();
     return(Json(client));
 }