Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using Storage_test.Models;
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Web;
- using System.Web.Mvc;
- namespace Storage_test.Controllers
- {
- public class StorageController : Controller
- {
- private StorageRecordContext _db = new StorageRecordContext();
- public ActionResult Create() {
- return View();
- }
- [HttpPost]
- public ActionResult Create(StorageRecord record){
- _db.TheRecords.Add(record);
- _db.SaveChanges();
- return RedirectToAction("Index");
- }
- //
- // GET: /Storage/
- public ActionResult Index()
- {
- var mostRecentRecord = (from record in _db.TheRecords select record).Take(20);
- ViewBag.allRecords = mostRecentRecord.ToList();
- return View();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement