public async Task <IActionResult> Edit(long id, OriginalListing originalListing) { if (id != originalListing.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(originalListing); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!OriginalListingExists(originalListing.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(originalListing)); }
public async Task <IActionResult> Create(OriginalListing originalListing) { if (ModelState.IsValid) { _context.Add(originalListing); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(originalListing)); }
public static List <OriginalListing> DataTableTooriginal_listing(DataTable data, int year, int batch) { List <OriginalListing> datas = new List <OriginalListing>(); foreach (DataRow item in data.Rows) { //var dd = item[0-1]; try { var tmp = new OriginalListing { FullName = item[1 - 1].ToString().Trim(), CmndNumber = item[2 - 1].ToString().Trim(), CmndIssueDay = item[3 - 1].ToString().Trim(), Address = item[4 - 1].ToString().Trim(), Country = item[5 - 1].ToString().Trim(), NumberStockNotDeposite = decimal.Parse(item[6 - 1].ToString().Trim()), NumberStockDeposited = decimal.Parse(item[7 - 1].ToString().Trim()), NumberStockTotal = decimal.Parse(item[8 - 1].ToString().Trim()), DividendNotDeposite = decimal.Parse(item[9 - 1].ToString().Trim()), DividendDeposited = decimal.Parse(item[10 - 1].ToString().Trim()), DividendTotal = decimal.Parse(item[11 - 1].ToString().Trim()), TaxNotDeposite = decimal.Parse(item[12 - 1].ToString().Trim()), TaxDeposited = decimal.Parse(item[13 - 1].ToString().Trim()), TaxTotal = decimal.Parse(item[14 - 1].ToString().Trim()), DividendReceivedNotDeposite = decimal.Parse(item[15 - 1].ToString().Trim()), DividendReceivedDeposited = decimal.Parse(item[16 - 1].ToString().Trim()), DividendReceivedTotal = decimal.Parse(item[17 - 1].ToString().Trim()), Type = item[18 - 1].ToString().Trim(), AssignmentOrganization = item[19 - 1].ToString().Trim(), Txnum = item[20 - 1].ToString().Trim(), Email = item[21 - 1].ToString().Trim(), Phone = item[22 - 1].ToString().Trim(), Note = item[23 - 1].ToString().Trim(), Year = year, Batch = batch }; datas.Add(tmp); } catch (System.FormatException) { } } return(datas); }