private void ImportSubPhylums() { if (subphylumCol != 0) { for (int i = 2; i <= worksheetGeneral.Dimension.Rows; i++) { if (worksheetGeneral.Cells[i, subphylumCol].Value != null) { var subphylumName = worksheetGeneral.Cells[i, subphylumCol].Value.ToString().Trim(); Taxon subphylumTaxon = new Taxon(); subphylumTaxon.TaxonName = subphylumName; subphylumTaxon.TaxonomyStateId = Constants.stateId_subphylum; subphylumTaxon.PhylumId = _getPhylumIdFromExcel(i); subphylumTaxon.KingdomId = _kingdomId; subphylumTaxon.Group = _getGroupInfo(i); if (!_checkTaxonExists(subphylumTaxon.TaxonName)) { _infContext.Taxon.Add(subphylumTaxon); _infContext.SaveChanges(); } else { var alreadyTax = _infContext.Taxon.Where(tax => tax.TaxonName == subphylumTaxon.TaxonName).FirstOrDefault(); if (!alreadyTax.Group.Contains(subphylumTaxon.Group)) { alreadyTax.Group += "," + subphylumTaxon.Group; _infContext.Update(alreadyTax); } } } } } }
public async Task <IActionResult> Edit(int id, [Bind("VideoID,VideoName,VideoNum,VideoURL")] Video video) { if (id != video.VideoID) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(video); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!VideoExists(video.VideoID)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(video)); }
public async Task <IActionResult> Edit(int id, [Bind("ID,Name,Author,Publisher,ISBN,Details,Rank,Price,ImageUrl")] Book book) { if (id != book.ID) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(book); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!BookExists(book.ID)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(book)); }
public async Task <IActionResult> Edit(int id, [Bind("PostId,Title,Content,Time")] Post post) { if (id != post.PostId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(post); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!PostExists(post.PostId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(post)); }
public async Task <IActionResult> Edit(int id, [Bind("BlogId,BlogUrl,BlogAuthor")] Blog blog) { if (id != blog.BlogId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(blog); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!BlogExists(blog.BlogId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(blog)); }