Permalink
Browse files

Updated Data Model, added controller

  • Loading branch information...
1 parent c71399b commit 8bdd89018d076b0a65fd1d26cf6c1744b28e2307 @sethwebster committed Apr 13, 2012
Showing with 65,063 additions and 0 deletions.
  1. +58 −0 Recurrence/App_Start/NinjectWebCommon.cs
  2. +113 −0 Recurrence/Areas/apiv1/Controllers/JobsController.cs
  3. +49 −0 Recurrence/Areas/apiv1/Views/Jobs/Create.cshtml
  4. +33 −0 Recurrence/Areas/apiv1/Views/Jobs/Delete.cshtml
  5. +30 −0 Recurrence/Areas/apiv1/Views/Jobs/Details.cshtml
  6. +51 −0 Recurrence/Areas/apiv1/Views/Jobs/Edit.cshtml
  7. +45 −0 Recurrence/Areas/apiv1/Views/Jobs/Index.cshtml
  8. BIN Recurrence/bin/Microsoft.Web.Infrastructure.dll
  9. BIN Recurrence/bin/Ninject.Web.Common.dll
  10. BIN Recurrence/bin/Ninject.Web.Common.pdb
  11. +227 −0 Recurrence/bin/Ninject.Web.Common.xml
  12. BIN Recurrence/bin/Ninject.Web.Mvc.dll
  13. BIN Recurrence/bin/Ninject.Web.Mvc.pdb
  14. +934 −0 Recurrence/bin/Ninject.Web.Mvc.xml
  15. BIN Recurrence/bin/Ninject.dll
  16. BIN Recurrence/bin/Ninject.pdb
  17. +6,134 −0 Recurrence/bin/Ninject.xml
  18. BIN Recurrence/bin/WebActivator.dll
  19. BIN Recurrence/obj/Debug/DesignTimeResolveAssemblyReferences.cache
  20. BIN Recurrence/obj/Debug/ResolveAssemblyReference.cache
  21. BIN packages/Microsoft.Web.Infrastructure.1.0.0.0/Microsoft.Web.Infrastructure.1.0.0.0.nupkg
  22. BIN packages/Microsoft.Web.Infrastructure.1.0.0.0/lib/net40/Microsoft.Web.Infrastructure.dll
  23. BIN packages/Ninject.3.0.0.15/Ninject.3.0.0.15.nupkg
  24. BIN packages/Ninject.3.0.0.15/lib/net35/Ninject.dll
  25. BIN packages/Ninject.3.0.0.15/lib/net35/Ninject.pdb
  26. +6,186 −0 packages/Ninject.3.0.0.15/lib/net35/Ninject.xml
  27. BIN packages/Ninject.3.0.0.15/lib/net40/Ninject.dll
  28. BIN packages/Ninject.3.0.0.15/lib/net40/Ninject.pdb
  29. +6,134 −0 packages/Ninject.3.0.0.15/lib/net40/Ninject.xml
  30. BIN packages/Ninject.3.0.0.15/lib/net45-full/Ninject.dll
  31. BIN packages/Ninject.3.0.0.15/lib/net45-full/Ninject.pdb
  32. +6,134 −0 packages/Ninject.3.0.0.15/lib/net45-full/Ninject.xml
  33. BIN packages/Ninject.3.0.0.15/lib/sl2/Ninject.dll
  34. BIN packages/Ninject.3.0.0.15/lib/sl2/Ninject.pdb
  35. +6,097 −0 packages/Ninject.3.0.0.15/lib/sl2/Ninject.xml
  36. BIN packages/Ninject.3.0.0.15/lib/sl3-wp/Ninject.dll
  37. BIN packages/Ninject.3.0.0.15/lib/sl3-wp/Ninject.pdb
  38. +6,048 −0 packages/Ninject.3.0.0.15/lib/sl3-wp/Ninject.xml
  39. BIN packages/Ninject.3.0.0.15/lib/sl3/Ninject.dll
  40. BIN packages/Ninject.3.0.0.15/lib/sl3/Ninject.pdb
  41. +6,097 −0 packages/Ninject.3.0.0.15/lib/sl3/Ninject.xml
  42. BIN packages/Ninject.3.0.0.15/lib/sl4-windowsphone71/Ninject.dll
  43. BIN packages/Ninject.3.0.0.15/lib/sl4-windowsphone71/Ninject.pdb
  44. +5,996 −0 packages/Ninject.3.0.0.15/lib/sl4-windowsphone71/Ninject.xml
  45. BIN packages/Ninject.3.0.0.15/lib/sl4/Ninject.dll
  46. BIN packages/Ninject.3.0.0.15/lib/sl4/Ninject.pdb
  47. +6,045 −0 packages/Ninject.3.0.0.15/lib/sl4/Ninject.xml
  48. BIN packages/Ninject.3.0.0.15/lib/sl5/Ninject.dll
  49. BIN packages/Ninject.3.0.0.15/lib/sl5/Ninject.pdb
  50. +6,045 −0 packages/Ninject.3.0.0.15/lib/sl5/Ninject.xml
  51. BIN packages/Ninject.MVC3.3.0.0.6/Ninject.MVC3.3.0.0.6.nupkg
  52. BIN packages/Ninject.MVC3.3.0.0.6/lib/net40-full/Ninject.Web.Mvc.dll
  53. BIN packages/Ninject.MVC3.3.0.0.6/lib/net40-full/Ninject.Web.Mvc.pdb
  54. +934 −0 packages/Ninject.MVC3.3.0.0.6/lib/net40-full/Ninject.Web.Mvc.xml
  55. BIN packages/Ninject.MVC3.3.0.0.6/lib/net45-full/Ninject.Web.Mvc.dll
  56. BIN packages/Ninject.MVC3.3.0.0.6/lib/net45-full/Ninject.Web.Mvc.pdb
  57. +934 −0 packages/Ninject.MVC3.3.0.0.6/lib/net45-full/Ninject.Web.Mvc.xml
  58. +58 −0 packages/Ninject.Web.Common.3.0.0.7/Content/App_Start/NinjectWebCommon.cs.pp
  59. BIN packages/Ninject.Web.Common.3.0.0.7/Ninject.Web.Common.3.0.0.7.nupkg
  60. BIN packages/Ninject.Web.Common.3.0.0.7/lib/net35-full/Ninject.Web.Common.dll
  61. BIN packages/Ninject.Web.Common.3.0.0.7/lib/net35-full/Ninject.Web.Common.pdb
  62. +227 −0 packages/Ninject.Web.Common.3.0.0.7/lib/net35-full/Ninject.Web.Common.xml
  63. BIN packages/Ninject.Web.Common.3.0.0.7/lib/net40-full/Ninject.Web.Common.dll
  64. BIN packages/Ninject.Web.Common.3.0.0.7/lib/net40-full/Ninject.Web.Common.pdb
  65. +227 −0 packages/Ninject.Web.Common.3.0.0.7/lib/net40-full/Ninject.Web.Common.xml
  66. BIN packages/Ninject.Web.Common.3.0.0.7/lib/net45-full/Ninject.Web.Common.dll
  67. BIN packages/Ninject.Web.Common.3.0.0.7/lib/net45-full/Ninject.Web.Common.pdb
  68. +227 −0 packages/Ninject.Web.Common.3.0.0.7/lib/net45-full/Ninject.Web.Common.xml
  69. BIN packages/WebActivator.1.5/WebActivator.1.5.nupkg
  70. BIN packages/WebActivator.1.5/lib/net40/WebActivator.dll
@@ -0,0 +1,58 @@
+[assembly: WebActivator.PreApplicationStartMethod(typeof(Recurrence.App_Start.NinjectWebCommon), "Start")]
+[assembly: WebActivator.ApplicationShutdownMethodAttribute(typeof(Recurrence.App_Start.NinjectWebCommon), "Stop")]
+
+namespace Recurrence.App_Start
+{
+ using System;
+ using System.Web;
+
+ using Microsoft.Web.Infrastructure.DynamicModuleHelper;
+
+ using Ninject;
+ using Ninject.Web.Common;
+
+ public static class NinjectWebCommon
+ {
+ private static readonly Bootstrapper bootstrapper = new Bootstrapper();
+
+ /// <summary>
+ /// Starts the application
+ /// </summary>
+ public static void Start()
+ {
+ DynamicModuleUtility.RegisterModule(typeof(OnePerRequestHttpModule));
+ DynamicModuleUtility.RegisterModule(typeof(NinjectHttpModule));
+ bootstrapper.Initialize(CreateKernel);
+ }
+
+ /// <summary>
+ /// Stops the application.
+ /// </summary>
+ public static void Stop()
+ {
+ bootstrapper.ShutDown();
+ }
+
+ /// <summary>
+ /// Creates the kernel that will manage your application.
+ /// </summary>
+ /// <returns>The created kernel.</returns>
+ private static IKernel CreateKernel()
+ {
+ var kernel = new StandardKernel();
+ kernel.Bind<Func<IKernel>>().ToMethod(ctx => () => new Bootstrapper().Kernel);
+ kernel.Bind<IHttpModule>().To<HttpApplicationInitializationHttpModule>();
+
+ RegisterServices(kernel);
+ return kernel;
+ }
+
+ /// <summary>
+ /// Load your modules or register your services here!
+ /// </summary>
+ /// <param name="kernel">The kernel.</param>
+ private static void RegisterServices(IKernel kernel)
+ {
+ }
+ }
+}
@@ -0,0 +1,113 @@
+using System;
+using System.Collections.Generic;
+using System.Data;
+using System.Data.Entity;
+using System.Linq;
+using System.Web;
+using System.Web.Mvc;
+using Recurrence.Models;
+
+namespace Recurrence.Areas.apiv1.Controllers
+{
+ public class JobsController : Controller
+ {
+ private IDataRepository db = null;
+
+ public JobsController(IDataRepository repository)
+ {
+ this.db = repository;
+ }
+
+ //
+ // GET: /apiv1/Jobs/
+
+ public ViewResult Index()
+ {
+ return View(db.Jobs.ToList());
+ }
+
+ //
+ // GET: /apiv1/Jobs/Details/5
+
+ public ViewResult Details(int id)
+ {
+ Job job = db.Jobs.Find(id);
+ return View(job);
+ }
+
+ //
+ // GET: /apiv1/Jobs/Create
+
+ public ActionResult Create()
+ {
+ return View();
+ }
+
+ //
+ // POST: /apiv1/Jobs/Create
+
+ [HttpPost]
+ public ActionResult Create(Job job)
+ {
+ if (ModelState.IsValid)
+ {
+ db.Jobs.Add(job);
+ db.SaveChanges();
+ return RedirectToAction("Index");
+ }
+
+ return View(job);
+ }
+
+ //
+ // GET: /apiv1/Jobs/Edit/5
+
+ public ActionResult Edit(int id)
+ {
+ Job job = db.Jobs.Find(id);
+ return View(job);
+ }
+
+ //
+ // POST: /apiv1/Jobs/Edit/5
+
+ [HttpPost]
+ public ActionResult Edit(Job job)
+ {
+ if (ModelState.IsValid)
+ {
+ db.Entry(job).State = EntityState.Modified;
+ db.SaveChanges();
+ return RedirectToAction("Index");
+ }
+ return View(job);
+ }
+
+ //
+ // GET: /apiv1/Jobs/Delete/5
+
+ public ActionResult Delete(int id)
+ {
+ Job job = db.Jobs.Find(id);
+ return View(job);
+ }
+
+ //
+ // POST: /apiv1/Jobs/Delete/5
+
+ [HttpPost, ActionName("Delete")]
+ public ActionResult DeleteConfirmed(int id)
+ {
+ Job job = db.Jobs.Find(id);
+ db.Jobs.Remove(job);
+ db.SaveChanges();
+ return RedirectToAction("Index");
+ }
+
+ protected override void Dispose(bool disposing)
+ {
+ db.Dispose();
+ base.Dispose(disposing);
+ }
+ }
+}
@@ -0,0 +1,49 @@
+@model Recurrence.Models.Job
+
+@{
+ ViewBag.Title = "Create";
+}
+
+<h2>Create</h2>
+
+<script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
+<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>
+
+@using (Html.BeginForm()) {
+ @Html.ValidationSummary(true)
+ <fieldset>
+ <legend>Job</legend>
+
+ <div class="editor-label">
+ @Html.LabelFor(model => model.When)
+ </div>
+ <div class="editor-field">
+ @Html.EditorFor(model => model.When)
+ @Html.ValidationMessageFor(model => model.When)
+ </div>
+
+ <div class="editor-label">
+ @Html.LabelFor(model => model.Method)
+ </div>
+ <div class="editor-field">
+ @Html.EditorFor(model => model.Method)
+ @Html.ValidationMessageFor(model => model.Method)
+ </div>
+
+ <div class="editor-label">
+ @Html.LabelFor(model => model.Attempts)
+ </div>
+ <div class="editor-field">
+ @Html.EditorFor(model => model.Attempts)
+ @Html.ValidationMessageFor(model => model.Attempts)
+ </div>
+
+ <p>
+ <input type="submit" value="Create" />
+ </p>
+ </fieldset>
+}
+
+<div>
+ @Html.ActionLink("Back to List", "Index")
+</div>
@@ -0,0 +1,33 @@
+@model Recurrence.Models.Job
+
+@{
+ ViewBag.Title = "Delete";
+}
+
+<h2>Delete</h2>
+
+<h3>Are you sure you want to delete this?</h3>
+<fieldset>
+ <legend>Job</legend>
+
+ <div class="display-label">When</div>
+ <div class="display-field">
+ @Html.DisplayFor(model => model.When)
+ </div>
+
+ <div class="display-label">Method</div>
+ <div class="display-field">
+ @Html.DisplayFor(model => model.Method)
+ </div>
+
+ <div class="display-label">Attempts</div>
+ <div class="display-field">
+ @Html.DisplayFor(model => model.Attempts)
+ </div>
+</fieldset>
+@using (Html.BeginForm()) {
+ <p>
+ <input type="submit" value="Delete" /> |
+ @Html.ActionLink("Back to List", "Index")
+ </p>
+}
@@ -0,0 +1,30 @@
+@model Recurrence.Models.Job
+
+@{
+ ViewBag.Title = "Details";
+}
+
+<h2>Details</h2>
+
+<fieldset>
+ <legend>Job</legend>
+
+ <div class="display-label">When</div>
+ <div class="display-field">
+ @Html.DisplayFor(model => model.When)
+ </div>
+
+ <div class="display-label">Method</div>
+ <div class="display-field">
+ @Html.DisplayFor(model => model.Method)
+ </div>
+
+ <div class="display-label">Attempts</div>
+ <div class="display-field">
+ @Html.DisplayFor(model => model.Attempts)
+ </div>
+</fieldset>
+<p>
+ @Html.ActionLink("Edit", "Edit", new { id=Model.JobId }) |
+ @Html.ActionLink("Back to List", "Index")
+</p>
@@ -0,0 +1,51 @@
+@model Recurrence.Models.Job
+
+@{
+ ViewBag.Title = "Edit";
+}
+
+<h2>Edit</h2>
+
+<script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
+<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>
+
+@using (Html.BeginForm()) {
+ @Html.ValidationSummary(true)
+ <fieldset>
+ <legend>Job</legend>
+
+ @Html.HiddenFor(model => model.JobId)
+
+ <div class="editor-label">
+ @Html.LabelFor(model => model.When)
+ </div>
+ <div class="editor-field">
+ @Html.EditorFor(model => model.When)
+ @Html.ValidationMessageFor(model => model.When)
+ </div>
+
+ <div class="editor-label">
+ @Html.LabelFor(model => model.Method)
+ </div>
+ <div class="editor-field">
+ @Html.EditorFor(model => model.Method)
+ @Html.ValidationMessageFor(model => model.Method)
+ </div>
+
+ <div class="editor-label">
+ @Html.LabelFor(model => model.Attempts)
+ </div>
+ <div class="editor-field">
+ @Html.EditorFor(model => model.Attempts)
+ @Html.ValidationMessageFor(model => model.Attempts)
+ </div>
+
+ <p>
+ <input type="submit" value="Save" />
+ </p>
+ </fieldset>
+}
+
+<div>
+ @Html.ActionLink("Back to List", "Index")
+</div>
@@ -0,0 +1,45 @@
+@model IEnumerable<Recurrence.Models.Job>
+
+@{
+ ViewBag.Title = "Index";
+}
+
+<h2>Index</h2>
+
+<p>
+ @Html.ActionLink("Create New", "Create")
+</p>
+<table>
+ <tr>
+ <th>
+ When
+ </th>
+ <th>
+ Method
+ </th>
+ <th>
+ Attempts
+ </th>
+ <th></th>
+ </tr>
+
+@foreach (var item in Model) {
+ <tr>
+ <td>
+ @Html.DisplayFor(modelItem => item.When)
+ </td>
+ <td>
+ @Html.DisplayFor(modelItem => item.Method)
+ </td>
+ <td>
+ @Html.DisplayFor(modelItem => item.Attempts)
+ </td>
+ <td>
+ @Html.ActionLink("Edit", "Edit", new { id=item.JobId }) |
+ @Html.ActionLink("Details", "Details", new { id=item.JobId }) |
+ @Html.ActionLink("Delete", "Delete", new { id=item.JobId })
+ </td>
+ </tr>
+}
+
+</table>
Binary file not shown.
Binary file not shown.
Binary file not shown.
Oops, something went wrong.

0 comments on commit 8bdd890

Please sign in to comment.