Guest User

Untitled

a guest
Nov 23rd, 2017
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.18 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Web;
  5. using System.Web.Mvc;
  6. using TikanpoikaYllapito1.Models;
  7.  
  8. namespace TikanpoikaYllapito1.Controllers
  9. {
  10. public class YllapitoController : Controller
  11. {
  12. TikanpoikaYllapito1.Models.TikanpoikaEntities _db = new TikanpoikaYllapito1.Models.TikanpoikaEntities();
  13. //
  14. // GET: /Yllapito/
  15.  
  16. public ActionResult Index()
  17. {
  18. return View(_db.Tuote.ToList());
  19. }
  20.  
  21. //
  22. // GET: /Yllapito/Details/5
  23.  
  24. public ActionResult Details(int id)
  25. {
  26. return View();
  27. }
  28.  
  29. //
  30. // GET: /Yllapito/Create
  31.  
  32. public ActionResult Create()
  33. {
  34. return View();
  35. }
  36.  
  37. //
  38. // POST: /Yllapito/Create
  39.  
  40. [HttpPost]
  41. public ActionResult Create(Tuote tuoteToCreate)
  42. {
  43. if (!ModelState.IsValid)
  44. return View();
  45. _db.AddToTuote(tuoteToCreate);
  46. _db.SaveChanges();
  47. return RedirectToAction("Index");
  48. }
  49.  
  50. //
  51. // GET: /Yllapito/Edit/5
  52.  
  53. public ActionResult Edit(int id)
  54. {
  55. return View();
  56. }
  57.  
  58. //
  59. // POST: /Yllapito/Edit/5
  60.  
  61. [HttpPost]
  62. public ActionResult Edit(int id, FormCollection collection)
  63. {
  64. try
  65. {
  66. // TODO: Add update logic here
  67.  
  68. return RedirectToAction("Index");
  69. }
  70. catch
  71. {
  72. return View();
  73. }
  74. }
  75.  
  76. //
  77. // GET: /Yllapito/Delete/5
  78.  
  79. public ActionResult Delete(int id)
  80. {
  81. return View();
  82. }
  83.  
  84. //
  85. // POST: /Yllapito/Delete/5
  86.  
  87. [HttpPost]
  88. public ActionResult Delete(int id, FormCollection collection)
  89. {
  90. try
  91. {
  92. // TODO: Add delete logic here
  93.  
  94. return RedirectToAction("Index");
  95. }
  96. catch
  97. {
  98. return View();
  99. }
  100. }
  101. }
  102. }
Add Comment
Please, Sign In to add comment