Hello guys wanna ask help because I don't understand how to create database that I can use using MASSIVE.CS in ASP.NET MVC 3.
Im stuck in figuring out how I can implement this MASSIVE class to my MVC project and how connection string connects in northwind database. I only have this tutorial https://github.com/robconery/massive but I'm still having problems understanding.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using MovieMassive.Models;
namespace MovieMassive.Controllers
{
public class MoviesController : Controller
{
MovieTable dbMovies = new MovieTable();
public ActionResult Index()
{
dbMovies.Query("SELECT * FROM MovieTable");
return View(dbMovies);
}
public ActionResult Add() {
return View();
}
}
}
Connection string:
<add name="MyConnectionString" connectionString="data source=|DataDirectory|MyDatabase.sdf" providerName="System.Data.SqlServerCe.4.0"/>
MovieTable Class:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Massive;
namespace MovieMassive.Models
{
public class MovieTable : DynamicModel
{
public MovieTable() : base("movieMassive", "MovieTable", "ID") { }
}
}
Okay here's what I want, Can you help me how to run correctly the View Index.cshtml
. The properties are not there yet. because don't know hot to implement it with database... Any help will be greatly appreciated..
@model IEnumerable<MovieMassive.Models.MovieTable>
@{
ViewBag.Title = "Index";
}
<h2>Index</h2>
<p>
@Html.ActionLink("Create New", "Create")
</p>
<table>
<tr>
<th>Title</th>
<th>ReleaseDate</th>
<th>Genre</th>
<th>Price</th>
<th>Rating</th>
</tr>
@foreach (var item in Model) {
<tr>
<td>
@Html.DisplayFor(modelItem => item.Title)
</td>
<td>
@Html.DisplayFor(modelItem => item.ReleaseDate)
</td>
<td>
@Html.DisplayFor(modelItem => item.Genre)
</td>
<td>
@Html.DisplayFor(modelItem => item.Price)
</td>
<td>
@Html.ActionLink("Edit", "Edit", new { id=item.ID }) |
@Html.ActionLink("Details", "Details", new { id=item.ID }) |
@Html.ActionLink("Delete", "Delete", new { id=item.ID })
</td>
</tr>
}
</table>
I need this one to run correctly to create a basic CRUD using massive. Thanks in advance..