Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public ActionResult Create(int id)
- {
- ViewBag.id = id;
- ViewBag.DataFormatID = new SelectList(db.DataFormat, "DataFormatID", "FormatName");
- ViewBag.TCID = new SelectList(db.TC, "TCID", "TCName",id);
- return View();
- }
- public class TC
- {
- public int TCID { get; set; }
- public string TCName { get; set; }
- public virtual ICollection<TCSet> TCSets { get; set; }
- }
- public class TCSet
- {
- public int TCSetID { get; set; }
- public string ValueName { get; set; }
- // public string DataFormat { get; set; }
- public DataUsage DataUsage { get; set; }
- public DataStatus DataStatus { get; set; }
- public int TCID { get; set; }
- public int DataFormatID { get; set; }
- public virtual TC TC { get; set; }
- public virtual DataFormat DataFormat { get; set; }
- }
- public ActionResult ViewTCSet(int ?id)
- {
- var viewmodel = new TC_TCSet();
- if(id!=null)
- {
- ViewBag.TCID = id.Value;
- var tcSet = db.TC.Include(x => x.TCSets).FirstOrDefault(x => x.TCID == id);
- if(tcSet!=null)
- {
- viewmodel.TCSet = tcSet.TCSets;
- }
- }
- return View(viewmodel);
- }
- @model TCImplementation.ViewModels.TC_TCSet
- @{
- ViewBag.Title = "ViewTCSet";
- }
- <table>
- <tr>
- <th>Tc Set Name</th>
- <th>Data Usage</th>
- <th>Data Status</th>
- <th>Data Format</th>
- </tr>
- @foreach(var item in Model.TCSet)
- {
- <tr>
- <td>@item.ValueName</td>
- <td>@item.DataUsage</td>
- <td>@item.DataStatus</td>
- <td>@item.DataFormat.FormatName</td>
- <td>@Html.ActionLink("Edit", "Edit", "TCSets", new { id= item.TCSetID},null) | @Html.ActionLink("Details", "Details", "TCSets", new { id = item.TCSetID }, null) | @Html.ActionLink("Delete", "Delete", "TCSets", new { id = item.TCSetID }, null)</td>
- </tr>
- }
- </table>
- @Html.ActionLink("Create", "Create", "TCSets", new { id = Model.TCSet }, null)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement