public async Task <ActionResult> DeleteConfirmed(int id) { ReadyPC readyPC = await context.ReadyPCs.FindAsync(id); context.ReadyPCs.Remove(readyPC); await context.SaveChangesAsync(); TempData["SuccessMessage"] = "Запись удалена"; return(RedirectToAction("Index")); }
public async Task <ActionResult> Edit([Bind(Include = " ReadyPCId,SupplierId,PurchasePrice,PCName,CharacteristicPC,Amount,")] ReadyPC readyPC) { if (ModelState.IsValid) { context.Entry(readyPC).State = EntityState.Modified; await context.SaveChangesAsync(); TempData["SuccessMessage"] = "Запись сохранена"; return(RedirectToAction("Index")); } ViewBag.SupplierId = new SelectList(context.Suppliers, "SupplierId", "SupplierFirm", readyPC.SupplierId); return(View(readyPC)); }
// GET: ReadyPC/Details/5 public async Task <ActionResult> Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } ReadyPC readyPC = await context.ReadyPCs.FindAsync(id); if (readyPC == null) { return(HttpNotFound()); } return(View(readyPC)); }
// GET: ReadyPC/Edit/5 public async Task <ActionResult> Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } ReadyPC readyPC = await context.ReadyPCs.FindAsync(id); if (readyPC == null) { return(HttpNotFound()); } ViewBag.SupplierId = new SelectList(context.Suppliers, "SupplierId", "SupplierFirm"); return(View(readyPC)); }