This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(document).ready(function () { | |
$('#createEvent').click(function () { | |
$('#feedback').removeClass().html('').fadeOut('slow'); //optional, but nice | |
var form = $('#createForm'); | |
$.ajax({ | |
type: "POST", | |
url: $(form).attr('action'), | |
data: $(form).serialize(), | |
error: function () { | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//the flags | |
[Flags] | |
public enum Role | |
{ | |
None = 0x0, | |
User = 0x1, | |
Administrator = 0x2, | |
SysAdmin = 0x4 | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[HttpPost] | |
[ValidateAntiForgeryToken] | |
public ActionResult Upload(int id, IEnumerable<HttpPostedFileBase> files) | |
{ | |
var results = new List<UploadResult>(); | |
var uploads = new List<PhotoUpload>(); | |
foreach (var file in files) | |
{ | |
if (file.ContentLength > 0) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$('a[href$="@Request.RawUrl.Replace("/",@"\/")"]').parent().addClass('active'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static bool IsNull<T>(this T instanceToCheck) where T : class | |
{ | |
return instanceToCheck == default(T); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//the 'domain/service' layer... | |
public class ContactService | |
{ | |
public ContactService(IContactRepository contactRepository) | |
{ | |
_contactRepository = contactRepository; | |
} | |
public Contact GetContact(int id) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ICACLS C:\inetpub\wwwroot\MyWebsite /grant "IIS APPPOOL\MyAppPool":(OI)(CI)(RX) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
kernel.Bind(x => x.FromAssembliesMatching("Company.Product.Namespace.*") | |
.SelectAllClasses() | |
.BindDefaultInterface() | |
.Configure(b => b.InRequestScope())); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Data.Entity; | |
using System.Diagnostics; | |
using NUnit.Framework; | |
namespace EntityFrameworkTests | |
{ | |
//TODO replace this stub with your own | |
public class MyDataContext : DbContext | |
{} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Test] | |
public void AllApiControllersInProjectInheritFromBaseApiController() | |
{ | |
var apiBaseType = typeof(BaseApiController); | |
var controllerTypes = (from type in apiBaseType.Assembly.GetTypes() | |
where type.Name.EndsWith("Controller") && type.IsSubclassOf(typeof(ApiController)) | |
&& !type.IsSubclassOf(typeof (BaseApiController)) | |
&& type != typeof(BaseApiController) | |
select type.Name).ToArray(); |
OlderNewer