public async Task <IActionResult> Edit(int id, [Bind("Id,Code,DescriptionRU,DescriptionKK,DescriptionEN")] ChemicalComp chemicalComp) { if (id != chemicalComp.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(chemicalComp); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ChemicalCompExists(chemicalComp.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(chemicalComp)); }
public async Task <ActionResult> DeleteConfirmed(int id) { ChemicalComp chemicalComp = await db.ChemicalComps.FindAsync(id); db.ChemicalComps.Remove(chemicalComp); await db.SaveChangesAsync(); return(RedirectToAction("Index")); }
public async Task <ActionResult> Edit([Bind(Include = "Id,Code,Description")] ChemicalComp chemicalComp) { if (ModelState.IsValid) { db.Entry(chemicalComp).State = EntityState.Modified; await db.SaveChangesAsync(); return(RedirectToAction("Index")); } return(View(chemicalComp)); }
public async Task <IActionResult> Create([Bind("Id,Code,DescriptionRU,DescriptionKK,DescriptionEN")] ChemicalComp chemicalComp) { if (ModelState.IsValid) { _context.Add(chemicalComp); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(chemicalComp)); }
public async Task <ActionResult> Create([Bind(Include = "Id,Code,Description")] ChemicalComp chemicalComp) { if (ModelState.IsValid) { db.ChemicalComps.Add(chemicalComp); await db.SaveChangesAsync(); return(RedirectToAction("Index")); } return(View(chemicalComp)); }
public async Task <ActionResult> Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } ChemicalComp chemicalComp = await db.ChemicalComps.FindAsync(id); if (chemicalComp == null) { return(HttpNotFound()); } return(View(chemicalComp)); }