Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Web;
- using System.Web.Mvc;
- using TikanpoikaYllapito1.Models;
- namespace TikanpoikaYllapito1.Controllers
- {
- public class YllapitoController : Controller
- {
- TikanpoikaYllapito1.Models.TikanpoikaEntities _db = new TikanpoikaYllapito1.Models.TikanpoikaEntities();
- //
- // GET: /Yllapito/
- public ActionResult Index()
- {
- return View(_db.Tuote.ToList());
- }
- //
- // GET: /Yllapito/Details/5
- public ActionResult Details(int id)
- {
- return View();
- }
- //
- // GET: /Yllapito/Create
- public ActionResult Create()
- {
- return View();
- }
- //
- // POST: /Yllapito/Create
- [HttpPost]
- public ActionResult Create(Tuote tuoteToCreate)
- {
- if (!ModelState.IsValid)
- return View();
- _db.AddToTuote(tuoteToCreate);
- _db.SaveChanges();
- return RedirectToAction("Index");
- }
- //
- // GET: /Yllapito/Edit/5
- public ActionResult Edit(int id)
- {
- return View();
- }
- //
- // POST: /Yllapito/Edit/5
- [HttpPost]
- public ActionResult Edit(int id, FormCollection collection)
- {
- try
- {
- // TODO: Add update logic here
- return RedirectToAction("Index");
- }
- catch
- {
- return View();
- }
- }
- //
- // GET: /Yllapito/Delete/5
- public ActionResult Delete(int id)
- {
- return View();
- }
- //
- // POST: /Yllapito/Delete/5
- [HttpPost]
- public ActionResult Delete(int id, FormCollection collection)
- {
- try
- {
- // TODO: Add delete logic here
- return RedirectToAction("Index");
- }
- catch
- {
- return View();
- }
- }
- }
- }
Add Comment
Please, Sign In to add comment