versione ocn edit OK
...prima delel modifiche che scombinano del tutto il DB...)
This commit is contained in:
@@ -18,6 +18,11 @@ namespace StockManMVC
|
||||
url: "{controller}/{action}/{id}",
|
||||
defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
|
||||
);
|
||||
routes.MapRoute(
|
||||
name: "Stocks",
|
||||
url: "{controller}/{action}/{id}/{LocationID}",
|
||||
defaults: new { controller = "Stocks", action = "Detail", id = UrlParameter.Optional, LocationID = UrlParameter.Optional }
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,13 +22,13 @@ namespace StockManMVC.Controllers
|
||||
}
|
||||
|
||||
// GET: Stocks/Details/5
|
||||
public ActionResult Details(int? id)
|
||||
public ActionResult Details(int? id, string LocationID)
|
||||
{
|
||||
if (id == null)
|
||||
{
|
||||
return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
|
||||
}
|
||||
Stock stock = db.Stock.Find(id);
|
||||
Stock stock = db.Stock.Find(id, LocationID);
|
||||
if (stock == null)
|
||||
{
|
||||
return HttpNotFound();
|
||||
@@ -64,13 +64,13 @@ namespace StockManMVC.Controllers
|
||||
}
|
||||
|
||||
// GET: Stocks/Edit/5
|
||||
public ActionResult Edit(int? id)
|
||||
public ActionResult Edit(int? id, string LocationID)
|
||||
{
|
||||
if (id == null)
|
||||
{
|
||||
return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
|
||||
}
|
||||
Stock stock = db.Stock.Find(id);
|
||||
Stock stock = db.Stock.Find(id,LocationID);
|
||||
if (stock == null)
|
||||
{
|
||||
return HttpNotFound();
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
|
||||
namespace StockManMVC.Models
|
||||
{
|
||||
public class ItemsMetadata
|
||||
{
|
||||
[StringLength(250)]
|
||||
[Display(Name = "Descrizione Articolo")]
|
||||
public string Descr;
|
||||
|
||||
[StringLength(50)]
|
||||
[Display(Name = "Famiglia Articolo")]
|
||||
public string Family;
|
||||
|
||||
[StringLength(250)]
|
||||
[Display(Name = "Descrizione Articolo Ext")]
|
||||
public string DescrExt;
|
||||
|
||||
[StringLength(250)]
|
||||
[Display(Name = "Cod Articolo Ext")]
|
||||
public string CodExt;
|
||||
|
||||
[StringLength(50)]
|
||||
[Display(Name = "Cod Articolo Int")]
|
||||
public string CodInt;
|
||||
|
||||
}
|
||||
|
||||
public class StocksMetadata
|
||||
{
|
||||
[DisplayFormat(DataFormatString = "{0:yyyy-MM-dd}", ApplyFormatInEditMode = true)]
|
||||
[DataType(DataType.Date)]
|
||||
public Nullable<System.DateTime> dtLastUpd;
|
||||
}
|
||||
|
||||
//public class EnrollmentMetadata
|
||||
//{
|
||||
// [Range(0, 4)]
|
||||
// public Nullable<decimal> Grade;
|
||||
//}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
|
||||
namespace StockManMVC.Models
|
||||
{
|
||||
[MetadataType(typeof(ItemsMetadata))]
|
||||
public partial class Items
|
||||
{
|
||||
}
|
||||
[MetadataType(typeof(StocksMetadata))]
|
||||
public partial class Stocks
|
||||
{
|
||||
}
|
||||
|
||||
//[MetadataType(typeof(EnrollmentMetadata))]
|
||||
//public partial class Enrollment
|
||||
//{
|
||||
//}
|
||||
}
|
||||
@@ -172,9 +172,11 @@
|
||||
<Compile Include="Models\LocType.cs">
|
||||
<DependentUpon>SMModel.tt</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Models\Metadata.cs" />
|
||||
<Compile Include="Models\MovType.cs">
|
||||
<DependentUpon>SMModel.tt</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Models\PartialClasses.cs" />
|
||||
<Compile Include="Models\SMModel.Context.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DesignTime>True</DesignTime>
|
||||
|
||||
@@ -29,29 +29,30 @@
|
||||
<th></th>
|
||||
</tr>
|
||||
|
||||
@foreach (var item in Model) {
|
||||
<tr>
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => item.QtyConf)
|
||||
</td>
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => item.Note)
|
||||
</td>
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => item.dtLastUpd)
|
||||
</td>
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => item.Location.Descr)
|
||||
</td>
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => item.Items.Descr)
|
||||
</td>
|
||||
<td>
|
||||
@Html.ActionLink("Edit", "Edit", new { /* id=item.PrimaryKey */ }) |
|
||||
@Html.ActionLink("Details", "Details", new { /* id=item.PrimaryKey */ }) |
|
||||
@Html.ActionLink("Delete", "Delete", new { /* id=item.PrimaryKey */ })
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
@foreach (var item in Model)
|
||||
{
|
||||
<tr>
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => item.QtyConf)
|
||||
</td>
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => item.Note)
|
||||
</td>
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => item.dtLastUpd)
|
||||
</td>
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => item.Location.Descr)
|
||||
</td>
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => item.Items.Descr)
|
||||
</td>
|
||||
<td>
|
||||
@Html.ActionLink("Edit", "Edit", new { id = item.ItemID, LocationID = item.LocationID }) |
|
||||
@Html.ActionLink("Details", "Details", new { id = item.ItemID, LocationID = item.LocationID }) |
|
||||
@Html.ActionLink("Delete", "Delete", new { id = item.ItemID, LocationID = item.LocationID })
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
|
||||
</table>
|
||||
|
||||
Binary file not shown.
Reference in New Issue
Block a user