Permalink
Browse files

Source code format and style cleanup.

  • Loading branch information...
1 parent 1ff4ffe commit 0ec33cdb77cceea4c67a8aa9df340e9e1d13e6fc @Haacked committed Dec 31, 2011
Showing with 316 additions and 193 deletions.
  1. +3 −2 src/AspNetHaack.DemoWeb/AspNetHaack.DemoWeb.csproj
  2. +1 −1 src/AspNetHaack.DemoWeb/packages.config
  3. +3 −2 src/AspNetHaack/AspNetHaack.csproj
  4. +1 −1 src/AspNetHaack/packages.config
  5. +10 −5 src/MvcHaack.Ajax.DemoWeb/App_Start/AjaxDemoAppStart.cs
  6. +6 −3 src/MvcHaack.Ajax.DemoWeb/App_Start/EntityFramework.SqlServerCompact.cs
  7. +10 −5 src/MvcHaack.Ajax.DemoWeb/Areas/MvcAjaxDemo/AjaxDemoAreaRegistration.cs
  8. +18 −9 src/MvcHaack.Ajax.DemoWeb/Areas/MvcAjaxDemo/Controllers/ComicsController.cs
  9. +10 −6 src/MvcHaack.Ajax.DemoWeb/Areas/MvcAjaxDemo/Controllers/ComicsDemoController.cs
  10. +14 −7 src/MvcHaack.Ajax.DemoWeb/Areas/MvcAjaxDemo/Controllers/HomeController.cs
  11. +25 −13 src/MvcHaack.Ajax.DemoWeb/Areas/MvcAjaxDemo/Controllers/PublishersController.cs
  12. +4 −2 src/MvcHaack.Ajax.DemoWeb/Areas/MvcAjaxDemo/Models/ComicBook.cs
  13. +5 −3 src/MvcHaack.Ajax.DemoWeb/Areas/MvcAjaxDemo/Models/ComicContext.cs
  14. +4 −2 src/MvcHaack.Ajax.DemoWeb/Areas/MvcAjaxDemo/Models/Publisher.cs
  15. +10 −5 src/MvcHaack.Ajax.DemoWeb/Global.asax.cs
  16. +2 −2 src/MvcHaack.Ajax.DemoWeb/MvcHaack.Ajax.DemoWeb.csproj
  17. +1 −1 src/MvcHaack.Ajax.DemoWeb/packages.config
  18. +20 −10 src/MvcHaack.Ajax/JsonActionInvoker.cs
  19. +14 −7 src/MvcHaack.Ajax/JsonController.cs
  20. +10 −5 src/MvcHaack.Ajax/JsonRoute.cs
  21. +28 −14 src/MvcHaack.Ajax/ValidateJsonAntiForgeryTokenAttribute.cs
  22. +2 −2 src/MvcHaack.ControllerInspector/MvcHaack.ControllerInspector.csproj
  23. +1 −1 src/MvcHaack.ControllerInspector/packages.config
  24. +13 −8 src/MvcHaack.ViewMobilizer/ViewMobilizerForm.Designer.cs
  25. +33 −26 src/MvcHaack.ViewMobilizer/ViewMobilizerModel.cs
  26. +18 −9 src/MvcHaack.ViewMobilizer/ViewMobilizerRecipe.cs
  27. +18 −11 src/ViewMobilizerTests/ViewMobilizerModelTests.cs
  28. +3 −2 src/ViewMobilizerTests/ViewMobilizerTests.csproj
  29. +1 −1 src/ViewMobilizerTests/packages.config
  30. +12 −12 src/WebApiHaack.DemoWeb/Api/CommentsApi.cs
  31. +14 −14 src/WebApiHaack/ConfigExtensions.cs
  32. +2 −2 src/WebApiHaack/OperationHandlers/AuthOperationHandler.cs
@@ -63,8 +63,9 @@
<Reference Include="System.Configuration" />
<Reference Include="System.Web.Services" />
<Reference Include="System.EnterpriseServices" />
- <Reference Include="WebActivator, Version=1.4.4.0, Culture=neutral, processorArchitecture=MSIL">
- <HintPath>..\packages\WebActivator.1.4.4\lib\net40\WebActivator.dll</HintPath>
+ <Reference Include="WebActivator, Version=1.5.0.0, Culture=neutral, processorArchitecture=MSIL">
+ <SpecificVersion>False</SpecificVersion>
+ <HintPath>..\packages\WebActivator.1.5\lib\net40\WebActivator.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
@@ -3,5 +3,5 @@
<package id="jQuery" version="1.6.4" />
<package id="jQuery.vsdoc" version="1.6" />
<package id="Microsoft.Web.Infrastructure" version="1.0.0.0" />
- <package id="WebActivator" version="1.4.4" />
+ <package id="WebActivator" version="1.5" />
</packages>
@@ -45,8 +45,9 @@
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
- <Reference Include="WebActivator">
- <HintPath>..\packages\WebActivator.1.4.4\lib\net40\WebActivator.dll</HintPath>
+ <Reference Include="WebActivator, Version=1.5.0.0, Culture=neutral, processorArchitecture=MSIL">
+ <SpecificVersion>False</SpecificVersion>
+ <HintPath>..\packages\WebActivator.1.5\lib\net40\WebActivator.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Microsoft.Web.Infrastructure" version="1.0.0.0" />
- <package id="WebActivator" version="1.4.4" />
+ <package id="WebActivator" version="1.5" />
</packages>
@@ -3,15 +3,20 @@
[assembly: WebActivator.PreApplicationStartMethod(typeof(MvcHaack.Ajax.Sample.App_Start.AjaxDemoAppStart), "Start")]
-namespace MvcHaack.Ajax.Sample.App_Start {
- public static class AjaxDemoAppStart {
- public static void Start() {
+namespace MvcHaack.Ajax.Sample.App_Start
+{
+ public static class AjaxDemoAppStart
+ {
+ public static void Start()
+ {
Database.SetInitializer(new MyDropCreateDatabaseIfModelChanges());
}
}
- public class MyDropCreateDatabaseIfModelChanges : DropCreateDatabaseIfModelChanges<ComicContext> {
- protected override void Seed(ComicContext context) {
+ public class MyDropCreateDatabaseIfModelChanges : DropCreateDatabaseIfModelChanges<ComicContext>
+ {
+ protected override void Seed(ComicContext context)
+ {
var darkHorse = new Publisher { Name = "Dark Horse" };
context.Publishers.Add(darkHorse);
var marvel = new Publisher { Name = "Marvel" };
@@ -3,9 +3,12 @@
[assembly: WebActivator.PreApplicationStartMethod(typeof(MvcHaack.Ajax.Sample.App_Start.EntityFramework_SqlServerCompact), "Start")]
-namespace MvcHaack.Ajax.Sample.App_Start {
- public static class EntityFramework_SqlServerCompact {
- public static void Start() {
+namespace MvcHaack.Ajax.Sample.App_Start
+{
+ public static class EntityFramework_SqlServerCompact
+ {
+ public static void Start()
+ {
Database.DefaultConnectionFactory = new SqlCeConnectionFactory("System.Data.SqlServerCe.4.0");
}
}
@@ -1,14 +1,19 @@
using System.Web.Mvc;
-namespace MvcHaack.Ajax.Sample.Areas.AjaxDemo {
- public class AjaxDemoAreaRegistration : AreaRegistration {
- public override string AreaName {
- get {
+namespace MvcHaack.Ajax.Sample.Areas.AjaxDemo
+{
+ public class AjaxDemoAreaRegistration : AreaRegistration
+ {
+ public override string AreaName
+ {
+ get
+ {
return "MvcAjaxDemo";
}
}
- public override void RegisterArea(AreaRegistrationContext context) {
+ public override void RegisterArea(AreaRegistrationContext context)
+ {
context.Routes.Add(new JsonRoute("json/{controller}"));
context.MapRoute(
@@ -4,39 +4,48 @@
using System.Web.Mvc;
using MvcHaack.Ajax.Sample.Models;
-namespace MvcHaack.Ajax.Sample.Areas.AjaxDemo.Controllers {
- public class ComicsController : JsonController {
+namespace MvcHaack.Ajax.Sample.Areas.AjaxDemo.Controllers
+{
+ public class ComicsController : JsonController
+ {
private ComicContext db = new ComicContext();
- public IEnumerable<ComicBook> List() {
+ public IEnumerable<ComicBook> List()
+ {
return db.ComicBooks.ToList();
}
[HttpPost]
- public ComicBook Create(ComicBook comicbook) {
- if (ModelState.IsValid) {
+ public ComicBook Create(ComicBook comicbook)
+ {
+ if (ModelState.IsValid)
+ {
db.ComicBooks.Add(comicbook);
db.SaveChanges();
}
return comicbook;
}
[HttpPost]
- public void Edit(ComicBook comicbook) {
- if (ModelState.IsValid) {
+ public void Edit(ComicBook comicbook)
+ {
+ if (ModelState.IsValid)
+ {
db.Entry(comicbook).State = EntityState.Modified;
db.SaveChanges();
}
}
[HttpPost]
- public void Delete(int id) {
+ public void Delete(int id)
+ {
ComicBook comicbook = db.ComicBooks.Find(id);
db.ComicBooks.Remove(comicbook);
db.SaveChanges();
}
- protected override void Dispose(bool disposing) {
+ protected override void Dispose(bool disposing)
+ {
db.Dispose();
base.Dispose(disposing);
}
@@ -1,23 +1,27 @@
using System.Collections;
-using System.Web.Mvc;
using MvcHaack.Ajax.Sample.Models;
-namespace MvcHaack.Ajax.Sample.Areas.AjaxDemo.Controllers {
- public class ComicsDemoController : JsonController {
- public IEnumerable List() {
+namespace MvcHaack.Ajax.Sample.Areas.AjaxDemo.Controllers
+{
+ public class ComicsDemoController : JsonController
+ {
+ public IEnumerable List()
+ {
return new[] {
new {Id = 1, Title = "Groo"},
new {Id = 1, Title = "Batman"},
new {Id = 1, Title = "Spiderman"}
};
}
- public object Save(ComicBook book) {
+ public object Save(ComicBook book)
+ {
return new { message = "Saved!", comic = book };
}
[ValidateJsonAntiForgeryToken]
- public object SaveSecure(ComicBook book) {
+ public object SaveSecure(ComicBook book)
+ {
return new { message = "Saved!", comic = book };
}
}
@@ -1,24 +1,31 @@
using System.Web.Mvc;
-namespace MvcHaack.Ajax.Sample.Areas.AjaxDemo.Controllers {
- public class HomeController : Controller {
- public ActionResult Index() {
+namespace MvcHaack.Ajax.Sample.Areas.AjaxDemo.Controllers
+{
+ public class HomeController : Controller
+ {
+ public ActionResult Index()
+ {
return View();
}
- public ActionResult ComicsDemo() {
+ public ActionResult ComicsDemo()
+ {
return View();
}
- public ActionResult ComicsPostDemo() {
+ public ActionResult ComicsPostDemo()
+ {
return View();
}
- public ActionResult SecureComicsPostDemo() {
+ public ActionResult SecureComicsPostDemo()
+ {
return View();
}
- public ActionResult KnockoutDemo() {
+ public ActionResult KnockoutDemo()
+ {
return View();
}
}
@@ -4,24 +4,30 @@
using System.Web.Mvc;
using MvcHaack.Ajax.Sample.Models;
-namespace MvcHaack.Ajax.Sample.Areas.AjaxDemo.Controllers {
- public class PublishersController : JsonController {
- private ComicContext db = new ComicContext();
+namespace MvcHaack.Ajax.Sample.Areas.AjaxDemo.Controllers
+{
+ public class PublishersController : JsonController
+ {
+ private readonly ComicContext db = new ComicContext();
- public IEnumerable<Publisher> List() {
+ public IEnumerable<Publisher> List()
+ {
return from p in db.Publishers.ToList()
select new Publisher { Id = p.Id, Name = p.Name };
}
- public ViewResult Details(int id) {
+ public ViewResult Details(int id)
+ {
Publisher publisher = db.Publishers.Find(id);
return View(publisher);
}
[HttpPost]
- public bool Create(Publisher publisher) {
- if (ModelState.IsValid) {
+ public bool Create(Publisher publisher)
+ {
+ if (ModelState.IsValid)
+ {
db.Publishers.Add(publisher);
db.SaveChanges();
}
@@ -32,7 +38,8 @@ public class PublishersController : JsonController {
//
// GET: /Publishers/Edit/5
- public ActionResult Edit(int id) {
+ public ActionResult Edit(int id)
+ {
Publisher publisher = db.Publishers.Find(id);
return View(publisher);
}
@@ -41,8 +48,10 @@ public class PublishersController : JsonController {
// POST: /Publishers/Edit/5
[HttpPost]
- public ActionResult Edit(Publisher publisher) {
- if (ModelState.IsValid) {
+ public ActionResult Edit(Publisher publisher)
+ {
+ if (ModelState.IsValid)
+ {
db.Entry(publisher).State = EntityState.Modified;
db.SaveChanges();
return RedirectToAction("Index");
@@ -53,7 +62,8 @@ public class PublishersController : JsonController {
//
// GET: /Publishers/Delete/5
- public ActionResult Delete(int id) {
+ public ActionResult Delete(int id)
+ {
Publisher publisher = db.Publishers.Find(id);
return View(publisher);
}
@@ -62,14 +72,16 @@ public class PublishersController : JsonController {
// POST: /Publishers/Delete/5
[HttpPost, ActionName("Delete")]
- public ActionResult DeleteConfirmed(int id) {
+ public ActionResult DeleteConfirmed(int id)
+ {
Publisher publisher = db.Publishers.Find(id);
db.Publishers.Remove(publisher);
db.SaveChanges();
return RedirectToAction("Index");
}
- protected override void Dispose(bool disposing) {
+ protected override void Dispose(bool disposing)
+ {
db.Dispose();
base.Dispose(disposing);
}
@@ -1,5 +1,7 @@
-namespace MvcHaack.Ajax.Sample.Models {
- public class ComicBook {
+namespace MvcHaack.Ajax.Sample.Models
+{
+ public class ComicBook
+ {
public int Id { get; set; }
public string Title { get; set; }
public string Author { get; set; }
@@ -1,13 +1,15 @@
using System.Data.Entity;
-namespace MvcHaack.Ajax.Sample.Models {
- public class ComicContext : DbContext {
+namespace MvcHaack.Ajax.Sample.Models
+{
+ public class ComicContext : DbContext
+ {
// You can add custom code to this file. Changes will not be overwritten.
//
// If you want Entity Framework to drop and regenerate your database
// automatically whenever you change your model schema, add the following
// code to the Application_Start method in your Global.asax file.
- // Note: this will destroy and re-create your database with every model chanD:\dev\hg\codehaacks\src\MvcHaack.Ajax.DemoWeb\Areas\MvcAjaxDemo\Models\Publisher.csge.
+ // Note: this will destroy and re-create your database with every model change.
//
// System.Data.Entity.Database.SetInitializer(new System.Data.Entity.DropCreateDatabaseIfModelChanges<MvcHaack.Ajax.Sample.ComicContext>());
@@ -1,7 +1,9 @@
using System.Collections.Generic;
-namespace MvcHaack.Ajax.Sample.Models {
- public class Publisher {
+namespace MvcHaack.Ajax.Sample.Models
+{
+ public class Publisher
+ {
public int Id { get; set; }
public string Name { get; set; }
public virtual ICollection<ComicBook> ComicBooks { get; set; }
Oops, something went wrong.

0 comments on commit 0ec33cd

Please sign in to comment.