inizio aggiunta vista stock detail
da collegare x navigazione...
This commit is contained in:
@@ -0,0 +1,140 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Data.Entity;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Web;
|
||||
using System.Web.Mvc;
|
||||
using StockManMVC.Models;
|
||||
|
||||
namespace StockManMVC.Controllers
|
||||
{
|
||||
public class ItemFluxesController : Controller
|
||||
{
|
||||
private StockManEntities db = new StockManEntities();
|
||||
|
||||
// GET: ItemFluxes
|
||||
public ActionResult Index()
|
||||
{
|
||||
var itemFlux = db.ItemFlux.Include(i => i.Item).Include(i => i.Location).Include(i => i.MovType);
|
||||
return View(itemFlux.ToList());
|
||||
}
|
||||
|
||||
// GET: ItemFluxes/Details/5
|
||||
public ActionResult Details(int? id)
|
||||
{
|
||||
if (id == null)
|
||||
{
|
||||
return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
|
||||
}
|
||||
ItemFlux itemFlux = db.ItemFlux.Find(id);
|
||||
if (itemFlux == null)
|
||||
{
|
||||
return HttpNotFound();
|
||||
}
|
||||
return View(itemFlux);
|
||||
}
|
||||
|
||||
// GET: ItemFluxes/Create
|
||||
public ActionResult Create()
|
||||
{
|
||||
ViewBag.ItemID = new SelectList(db.Item, "ID", "Descr");
|
||||
ViewBag.LocationID = new SelectList(db.Location, "ID", "Descr");
|
||||
ViewBag.MovTypeID = new SelectList(db.MovType, "ID", "Descr");
|
||||
return View();
|
||||
}
|
||||
|
||||
// POST: ItemFluxes/Create
|
||||
// To protect from overposting attacks, please enable the specific properties you want to bind to, for
|
||||
// more details see http://go.microsoft.com/fwlink/?LinkId=317598.
|
||||
[HttpPost]
|
||||
[ValidateAntiForgeryToken]
|
||||
public ActionResult Create([Bind(Include = "ID,ItemID,LocationID,MovTypeID,ExtLocationID,dtMov,Qta,TotValue,UnitVal,Note,dtExport")] ItemFlux itemFlux)
|
||||
{
|
||||
if (ModelState.IsValid)
|
||||
{
|
||||
db.ItemFlux.Add(itemFlux);
|
||||
db.SaveChanges();
|
||||
return RedirectToAction("Index");
|
||||
}
|
||||
|
||||
ViewBag.ItemID = new SelectList(db.Item, "ID", "Descr", itemFlux.ItemID);
|
||||
ViewBag.LocationID = new SelectList(db.Location, "ID", "Descr", itemFlux.LocationID);
|
||||
ViewBag.MovTypeID = new SelectList(db.MovType, "ID", "Descr", itemFlux.MovTypeID);
|
||||
return View(itemFlux);
|
||||
}
|
||||
|
||||
// GET: ItemFluxes/Edit/5
|
||||
public ActionResult Edit(int? id)
|
||||
{
|
||||
if (id == null)
|
||||
{
|
||||
return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
|
||||
}
|
||||
ItemFlux itemFlux = db.ItemFlux.Find(id);
|
||||
if (itemFlux == null)
|
||||
{
|
||||
return HttpNotFound();
|
||||
}
|
||||
ViewBag.ItemID = new SelectList(db.Item, "ID", "Descr", itemFlux.ItemID);
|
||||
ViewBag.LocationID = new SelectList(db.Location, "ID", "Descr", itemFlux.LocationID);
|
||||
ViewBag.MovTypeID = new SelectList(db.MovType, "ID", "Descr", itemFlux.MovTypeID);
|
||||
return View(itemFlux);
|
||||
}
|
||||
|
||||
// POST: ItemFluxes/Edit/5
|
||||
// To protect from overposting attacks, please enable the specific properties you want to bind to, for
|
||||
// more details see http://go.microsoft.com/fwlink/?LinkId=317598.
|
||||
[HttpPost]
|
||||
[ValidateAntiForgeryToken]
|
||||
public ActionResult Edit([Bind(Include = "ID,ItemID,LocationID,MovTypeID,ExtLocationID,dtMov,Qta,TotValue,UnitVal,Note,dtExport")] ItemFlux itemFlux)
|
||||
{
|
||||
if (ModelState.IsValid)
|
||||
{
|
||||
db.Entry(itemFlux).State = EntityState.Modified;
|
||||
db.SaveChanges();
|
||||
return RedirectToAction("Index");
|
||||
}
|
||||
ViewBag.ItemID = new SelectList(db.Item, "ID", "Descr", itemFlux.ItemID);
|
||||
ViewBag.LocationID = new SelectList(db.Location, "ID", "Descr", itemFlux.LocationID);
|
||||
ViewBag.MovTypeID = new SelectList(db.MovType, "ID", "Descr", itemFlux.MovTypeID);
|
||||
return View(itemFlux);
|
||||
}
|
||||
|
||||
// GET: ItemFluxes/Delete/5
|
||||
public ActionResult Delete(int? id)
|
||||
{
|
||||
if (id == null)
|
||||
{
|
||||
return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
|
||||
}
|
||||
ItemFlux itemFlux = db.ItemFlux.Find(id);
|
||||
if (itemFlux == null)
|
||||
{
|
||||
return HttpNotFound();
|
||||
}
|
||||
return View(itemFlux);
|
||||
}
|
||||
|
||||
// POST: ItemFluxes/Delete/5
|
||||
[HttpPost, ActionName("Delete")]
|
||||
[ValidateAntiForgeryToken]
|
||||
public ActionResult DeleteConfirmed(int id)
|
||||
{
|
||||
ItemFlux itemFlux = db.ItemFlux.Find(id);
|
||||
db.ItemFlux.Remove(itemFlux);
|
||||
db.SaveChanges();
|
||||
return RedirectToAction("Index");
|
||||
}
|
||||
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing)
|
||||
{
|
||||
db.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,136 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Data.Entity;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Web;
|
||||
using System.Web.Mvc;
|
||||
using StockManMVC.Models;
|
||||
|
||||
namespace StockManMVC.Controllers
|
||||
{
|
||||
public class ItemStocksController : Controller
|
||||
{
|
||||
private StockManEntities db = new StockManEntities();
|
||||
|
||||
// GET: ItemStocks
|
||||
public ActionResult Index()
|
||||
{
|
||||
var itemStock = db.ItemStock.Include(i => i.Item).Include(i => i.Location);
|
||||
return View(itemStock.ToList());
|
||||
}
|
||||
|
||||
// GET: ItemStocks/Details/5
|
||||
public ActionResult Details(int? id)
|
||||
{
|
||||
if (id == null)
|
||||
{
|
||||
return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
|
||||
}
|
||||
ItemStock itemStock = db.ItemStock.Find(id);
|
||||
if (itemStock == null)
|
||||
{
|
||||
return HttpNotFound();
|
||||
}
|
||||
return View(itemStock);
|
||||
}
|
||||
|
||||
// GET: ItemStocks/Create
|
||||
public ActionResult Create()
|
||||
{
|
||||
ViewBag.ItemID = new SelectList(db.Item, "ID", "Descr");
|
||||
ViewBag.LocationID = new SelectList(db.Location, "ID", "Descr");
|
||||
return View();
|
||||
}
|
||||
|
||||
// POST: ItemStocks/Create
|
||||
// To protect from overposting attacks, please enable the specific properties you want to bind to, for
|
||||
// more details see http://go.microsoft.com/fwlink/?LinkId=317598.
|
||||
[HttpPost]
|
||||
[ValidateAntiForgeryToken]
|
||||
public ActionResult Create([Bind(Include = "ID,ItemID,LocationID,QtyConf,Note,dtLastUpd")] ItemStock itemStock)
|
||||
{
|
||||
if (ModelState.IsValid)
|
||||
{
|
||||
db.ItemStock.Add(itemStock);
|
||||
db.SaveChanges();
|
||||
return RedirectToAction("Index");
|
||||
}
|
||||
|
||||
ViewBag.ItemID = new SelectList(db.Item, "ID", "Descr", itemStock.ItemID);
|
||||
ViewBag.LocationID = new SelectList(db.Location, "ID", "Descr", itemStock.LocationID);
|
||||
return View(itemStock);
|
||||
}
|
||||
|
||||
// GET: ItemStocks/Edit/5
|
||||
public ActionResult Edit(int? id)
|
||||
{
|
||||
if (id == null)
|
||||
{
|
||||
return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
|
||||
}
|
||||
ItemStock itemStock = db.ItemStock.Find(id);
|
||||
if (itemStock == null)
|
||||
{
|
||||
return HttpNotFound();
|
||||
}
|
||||
ViewBag.ItemID = new SelectList(db.Item, "ID", "Descr", itemStock.ItemID);
|
||||
ViewBag.LocationID = new SelectList(db.Location, "ID", "Descr", itemStock.LocationID);
|
||||
return View(itemStock);
|
||||
}
|
||||
|
||||
// POST: ItemStocks/Edit/5
|
||||
// To protect from overposting attacks, please enable the specific properties you want to bind to, for
|
||||
// more details see http://go.microsoft.com/fwlink/?LinkId=317598.
|
||||
[HttpPost]
|
||||
[ValidateAntiForgeryToken]
|
||||
public ActionResult Edit([Bind(Include = "ID,ItemID,LocationID,QtyConf,Note,dtLastUpd")] ItemStock itemStock)
|
||||
{
|
||||
if (ModelState.IsValid)
|
||||
{
|
||||
db.Entry(itemStock).State = EntityState.Modified;
|
||||
db.SaveChanges();
|
||||
return RedirectToAction("Index");
|
||||
}
|
||||
ViewBag.ItemID = new SelectList(db.Item, "ID", "Descr", itemStock.ItemID);
|
||||
ViewBag.LocationID = new SelectList(db.Location, "ID", "Descr", itemStock.LocationID);
|
||||
return View(itemStock);
|
||||
}
|
||||
|
||||
// GET: ItemStocks/Delete/5
|
||||
public ActionResult Delete(int? id)
|
||||
{
|
||||
if (id == null)
|
||||
{
|
||||
return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
|
||||
}
|
||||
ItemStock itemStock = db.ItemStock.Find(id);
|
||||
if (itemStock == null)
|
||||
{
|
||||
return HttpNotFound();
|
||||
}
|
||||
return View(itemStock);
|
||||
}
|
||||
|
||||
// POST: ItemStocks/Delete/5
|
||||
[HttpPost, ActionName("Delete")]
|
||||
[ValidateAntiForgeryToken]
|
||||
public ActionResult DeleteConfirmed(int id)
|
||||
{
|
||||
ItemStock itemStock = db.ItemStock.Find(id);
|
||||
db.ItemStock.Remove(itemStock);
|
||||
db.SaveChanges();
|
||||
return RedirectToAction("Index");
|
||||
}
|
||||
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing)
|
||||
{
|
||||
db.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,127 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Data.Entity;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Web;
|
||||
using System.Web.Mvc;
|
||||
using StockManMVC.Models;
|
||||
|
||||
namespace StockManMVC.Controllers
|
||||
{
|
||||
public class ItemsController : Controller
|
||||
{
|
||||
private StockManEntities db = new StockManEntities();
|
||||
|
||||
// GET: Items
|
||||
public ActionResult Index()
|
||||
{
|
||||
return View(db.Item.ToList());
|
||||
}
|
||||
|
||||
// GET: Items/Details/5
|
||||
public ActionResult Details(int? id)
|
||||
{
|
||||
if (id == null)
|
||||
{
|
||||
return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
|
||||
}
|
||||
Item item = db.Item.Find(id);
|
||||
if (item == null)
|
||||
{
|
||||
return HttpNotFound();
|
||||
}
|
||||
return View(item);
|
||||
}
|
||||
|
||||
// GET: Items/Create
|
||||
public ActionResult Create()
|
||||
{
|
||||
return View();
|
||||
}
|
||||
|
||||
// POST: Items/Create
|
||||
// To protect from overposting attacks, please enable the specific properties you want to bind to, for
|
||||
// more details see http://go.microsoft.com/fwlink/?LinkId=317598.
|
||||
[HttpPost]
|
||||
[ValidateAntiForgeryToken]
|
||||
public ActionResult Create([Bind(Include = "ID,Descr,CodInt,Family,CodExt,DescrExt,QtaMin,QtaBatch,CurrValue")] Item item)
|
||||
{
|
||||
if (ModelState.IsValid)
|
||||
{
|
||||
db.Item.Add(item);
|
||||
db.SaveChanges();
|
||||
return RedirectToAction("Index");
|
||||
}
|
||||
|
||||
return View(item);
|
||||
}
|
||||
|
||||
// GET: Items/Edit/5
|
||||
public ActionResult Edit(int? id)
|
||||
{
|
||||
if (id == null)
|
||||
{
|
||||
return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
|
||||
}
|
||||
Item item = db.Item.Find(id);
|
||||
if (item == null)
|
||||
{
|
||||
return HttpNotFound();
|
||||
}
|
||||
return View(item);
|
||||
}
|
||||
|
||||
// POST: Items/Edit/5
|
||||
// To protect from overposting attacks, please enable the specific properties you want to bind to, for
|
||||
// more details see http://go.microsoft.com/fwlink/?LinkId=317598.
|
||||
[HttpPost]
|
||||
[ValidateAntiForgeryToken]
|
||||
public ActionResult Edit([Bind(Include = "ID,Descr,CodInt,Family,CodExt,DescrExt,QtaMin,QtaBatch,CurrValue")] Item item)
|
||||
{
|
||||
if (ModelState.IsValid)
|
||||
{
|
||||
db.Entry(item).State = EntityState.Modified;
|
||||
db.SaveChanges();
|
||||
return RedirectToAction("Index");
|
||||
}
|
||||
return View(item);
|
||||
}
|
||||
|
||||
// GET: Items/Delete/5
|
||||
public ActionResult Delete(int? id)
|
||||
{
|
||||
if (id == null)
|
||||
{
|
||||
return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
|
||||
}
|
||||
Item item = db.Item.Find(id);
|
||||
if (item == null)
|
||||
{
|
||||
return HttpNotFound();
|
||||
}
|
||||
return View(item);
|
||||
}
|
||||
|
||||
// POST: Items/Delete/5
|
||||
[HttpPost, ActionName("Delete")]
|
||||
[ValidateAntiForgeryToken]
|
||||
public ActionResult DeleteConfirmed(int id)
|
||||
{
|
||||
Item item = db.Item.Find(id);
|
||||
db.Item.Remove(item);
|
||||
db.SaveChanges();
|
||||
return RedirectToAction("Index");
|
||||
}
|
||||
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing)
|
||||
{
|
||||
db.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user