Rifacimento DB e sync
ora la struttura è + coerente, iniziato emrge dati, chiavi tutte SURROGATE con ID
This commit is contained in:
@@ -1,127 +0,0 @@
|
||||
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.Items.ToList());
|
||||
}
|
||||
|
||||
// GET: Items/Details/5
|
||||
public ActionResult Details(int? id)
|
||||
{
|
||||
if (id == null)
|
||||
{
|
||||
return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
|
||||
}
|
||||
Items items = db.Items.Find(id);
|
||||
if (items == null)
|
||||
{
|
||||
return HttpNotFound();
|
||||
}
|
||||
return View(items);
|
||||
}
|
||||
|
||||
// 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,Family,DescrExt,CodExt,CodInt,QtaMin,QtaBatch,Value")] Items items)
|
||||
{
|
||||
if (ModelState.IsValid)
|
||||
{
|
||||
db.Items.Add(items);
|
||||
db.SaveChanges();
|
||||
return RedirectToAction("Index");
|
||||
}
|
||||
|
||||
return View(items);
|
||||
}
|
||||
|
||||
// GET: Items/Edit/5
|
||||
public ActionResult Edit(int? id)
|
||||
{
|
||||
if (id == null)
|
||||
{
|
||||
return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
|
||||
}
|
||||
Items items = db.Items.Find(id);
|
||||
if (items == null)
|
||||
{
|
||||
return HttpNotFound();
|
||||
}
|
||||
return View(items);
|
||||
}
|
||||
|
||||
// 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,Family,DescrExt,CodExt,CodInt,QtaMin,QtaBatch,Value")] Items items)
|
||||
{
|
||||
if (ModelState.IsValid)
|
||||
{
|
||||
db.Entry(items).State = EntityState.Modified;
|
||||
db.SaveChanges();
|
||||
return RedirectToAction("Index");
|
||||
}
|
||||
return View(items);
|
||||
}
|
||||
|
||||
// GET: Items/Delete/5
|
||||
public ActionResult Delete(int? id)
|
||||
{
|
||||
if (id == null)
|
||||
{
|
||||
return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
|
||||
}
|
||||
Items items = db.Items.Find(id);
|
||||
if (items == null)
|
||||
{
|
||||
return HttpNotFound();
|
||||
}
|
||||
return View(items);
|
||||
}
|
||||
|
||||
// POST: Items/Delete/5
|
||||
[HttpPost, ActionName("Delete")]
|
||||
[ValidateAntiForgeryToken]
|
||||
public ActionResult DeleteConfirmed(int id)
|
||||
{
|
||||
Items items = db.Items.Find(id);
|
||||
db.Items.Remove(items);
|
||||
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