public async Task <ActionResult> DeleteConfirmed(int id) { MainWarehouse mainWarehouse = await db.MainWarehouses.FindAsync(id); db.MainWarehouses.Remove(mainWarehouse); await db.SaveChangesAsync(); return(RedirectToAction("Index")); }
// GET: MainWarehouses/Details/5 public async Task <ActionResult> Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } MainWarehouse mainWarehouse = await db.MainWarehouses.FindAsync(id); if (mainWarehouse == null) { return(HttpNotFound()); } return(View(mainWarehouse)); }
public async Task <ActionResult> Edit([Bind(Include = "MainWarehouseId,CompanyId,WarehouseId,Name,Phone,Address,DepartmentId,DistrictId")] MainWarehouse mainWarehouse) { if (ModelState.IsValid) { db.Entry(mainWarehouse).State = EntityState.Modified; await db.SaveChangesAsync(); return(RedirectToAction("Index")); } ViewBag.CompanyId = new SelectList(db.Companies, "CompanyId", "Name", mainWarehouse.CompanyId); ViewBag.DepartmentId = new SelectList(db.Departments, "DepartmentId", "Name", mainWarehouse.DepartmentId); ViewBag.DistrictId = new SelectList(db.Districts, "DistrictId", "Name", mainWarehouse.DistrictId); return(View(mainWarehouse)); }
public async Task <ActionResult> Create(MainWarehouse mainWarehouse) { if (ModelState.IsValid) { db.MainWarehouses.Add(mainWarehouse); await db.SaveChangesAsync(); return(RedirectToAction("Index")); } ViewBag.CompanyId = new SelectList(db.Companies, "CompanyId", "Name", mainWarehouse.CompanyId); ViewBag.DepartmentId = new SelectList(db.Departments, "DepartmentId", "Name", mainWarehouse.DepartmentId); ViewBag.DistrictId = new SelectList(db.Districts, "DistrictId", "Name", mainWarehouse.DistrictId); return(View(mainWarehouse)); }
// GET: MainWarehouses/Edit/5 public async Task <ActionResult> Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } MainWarehouse mainWarehouse = await db.MainWarehouses.FindAsync(id); if (mainWarehouse == null) { return(HttpNotFound()); } ViewBag.CompanyId = new SelectList(db.Companies, "CompanyId", "Name", mainWarehouse.CompanyId); ViewBag.DepartmentId = new SelectList(db.Departments, "DepartmentId", "Name", mainWarehouse.DepartmentId); ViewBag.DistrictId = new SelectList(db.Districts, "DistrictId", "Name", mainWarehouse.DistrictId); return(View(mainWarehouse)); }