public async Task <IActionResult> Edit(int id, [Bind("Id,HoldingInfoId,HoldingTypeId,TaxItemSettingId,Rate,TaxAmount,Remark")] HoldingTax holdingTax)
        {
            if (id != holdingTax.Id)
            {
                return(NotFound());
            }
            bool IsHoldingTaxExist = _context.HoldingTax.Any
                                         (x => x.HoldingInfoId == holdingTax.HoldingInfoId && x.Id != holdingTax.Id);

            if (IsHoldingTaxExist == true)
            {
                ModelState.AddModelError("HoldingInfoId", "Holding Id Already exit");
            }
            if (ModelState.IsValid)
            {
                try
                {
                    holdingTax.UpdateDate = DateTime.Now;
                    // holdingTax.UpdatedBy=
                    _context.Update(holdingTax);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!HoldingTaxExists(holdingTax.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["HoldingInfoId"]    = new SelectList(_context.HoldingInfo, "Id", "HoldingNo", holdingTax.HoldingInfoId);
            ViewData["HoldingTypeId"]    = new SelectList(_context.Set <HoldingType>(), "Id", "TypeName", holdingTax.HoldingTypeId);
            ViewData["TaxItemSettingId"] = new SelectList(_context.Set <TaxItemSetting>(), "Id", "ItemName", holdingTax.TaxItemSettingId);
            return(View(holdingTax));
        }
        public async Task <IActionResult> Create([Bind("Id,HoldingInfoId,HoldingTypeId,TaxItemSettingId,Rate,TaxAmount,Remark")] HoldingTax holdingTax)
        {
            bool IsHoldingTaxExist = _context.HoldingTax.Any
                                         (x => x.HoldingInfoId == holdingTax.HoldingInfoId && x.Id != holdingTax.Id);

            if (IsHoldingTaxExist == true)
            {
                ModelState.AddModelError("DivisonName", "Client Id Already exit");
            }
            if (ModelState.IsValid)
            {
                holdingTax.InsertDate = DateTime.Now;
                // holdingTax.InsertBy=
                _context.Add(holdingTax);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["HoldingInfoId"]    = new SelectList(_context.HoldingInfo, "Id", "HoldingNo", holdingTax.HoldingInfoId);
            ViewData["HoldingTypeId"]    = new SelectList(_context.Set <HoldingType>(), "Id", "TypeName", holdingTax.HoldingTypeId);
            ViewData["TaxItemSettingId"] = new SelectList(_context.Set <TaxItemSetting>(), "Id", "ItemName", holdingTax.TaxItemSettingId);
            return(View(holdingTax));
        }