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
var lessBundle = new Bundle("~/My/Less").IncludeDirectory("~/My", "*.less"); | |
lessBundle.Transforms.Add(new LessTransform()); | |
lessBundle.Transforms.Add(new CssMinify()); | |
bundles.Add(lessBundle); |
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 class LessTransform : IBundleTransform | |
{ | |
public void Process(BundleContext context, BundleResponse response) | |
{ | |
response.Content = dotless.Core.Less.Parse(response.Content); | |
response.ContentType = "text/css"; | |
} | |
} |
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
bundles.Add(new StyleBundle("~/Content/themes/base/css").Include( | |
"~/Content/themes/base/jquery.ui.core.css", | |
"~/Content/themes/base/jquery.ui.resizable.css", | |
"~/Content/themes/base/jquery.ui.selectable.css", | |
"~/Content/themes/base/jquery.ui.accordion.css", | |
"~/Content/themes/base/jquery.ui.autocomplete.css", | |
"~/Content/themes/base/jquery.ui.button.css", | |
"~/Content/themes/base/jquery.ui.dialog.css", | |
"~/Content/themes/base/jquery.ui.slider.css", | |
"~/Content/themes/base/jquery.ui.tabs.css", |
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
bundle = new Bundle("~/Content/themes/base/css", csstransformer); | |
bundle.AddFile("~/Content/themes/base/jquery.ui.core.css", true); | |
bundle.AddFile("~/Content/themes/base/jquery.ui.resizable.css", true); | |
bundle.AddFile("~/Content/themes/base/jquery.ui.selectable.css", true); | |
bundle.AddFile("~/Content/themes/base/jquery.ui.accordion.css", true); | |
bundle.AddFile("~/Content/themes/base/jquery.ui.autocomplete.css", true); | |
bundle.AddFile("~/Content/themes/base/jquery.ui.button.css", true); | |
bundle.AddFile("~/Content/themes/base/jquery.ui.dialog.css", true); | |
bundle.AddFile("~/Content/themes/base/jquery.ui.slider.css", true); | |
bundle.AddFile("~/Content/themes/base/jquery.ui.tabs.css", true); |
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
protected void Application_Start() | |
{ | |
//... | |
Bundle cssBundle = new Bundle("~/Content/css", new LessTransform().Then(new CssMinify())); | |
cssBundle.AddFile("~/Content/site.css", throwIfNotExist: false); | |
cssBundle.AddDirectory("~/Content/", "jquery.mobile*", searchSubdirectories: false, throwIfNotExist: false); | |
BundleTable.Bundles.Add(cssBundle); | |
//... |
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 HttpResponseMessage<IEnumerable<Bug>> Post(JsonObject formData) { | |
dynamic data = formData.AsDynamic(); | |
var bug = new Bug | |
{ | |
Name = data.name, | |
Priority = data.priority, | |
Rank = data.rank, | |
}; | |
_bugRepository.Add(bug); |
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 async Task<double> CalculateShippingSubtotalAsync(int productID, string postalCode) | |
{ | |
var productServiceProxy = new ProductServiceClient(); | |
var shippingServiceProxy = new ShippingServiceClient(); | |
var t = productServiceProxy.GetProductByIDAsync(productID); | |
var t2 = shippingServiceProxy.GetShippingCostForPostalCodeAsync(postalCode); | |
await Task.WhenAll(t, t2); |
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
[ServiceContractAttribute(Namespace = "http://microsoft.samples")] | |
public interface ISampleService | |
{ | |
[OperationContractAttribute] | |
string SampleMethod(string msg); | |
[OperationContractAttribute(AsyncPattern = true)] | |
IAsyncResult BeginSampleMethod(string msg, AsyncCallback callback, | |
object asyncState); |
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 void RegisterOAuth(this HttpConfiguration config, FacebookOAuthClient client) { | |
var existingFactory = config.RequestHandlers; | |
config.RequestHandlers = (c, e, od) => { | |
if (existingFactory != null) | |
existingFactory(c, e, od); | |
var authorizeAttribute = od.Attributes.OfType<AuthorizeAttribute>().FirstOrDefault(); | |
if (authorizeAttribute == null) return; | |
if (od.Name == "GetCommentsOauth") { |
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 class OAuthFacebookMessageHandler : DelegatingHandler | |
{ | |
static readonly Uri FacebookBaseGraphUri = new Uri("https://graph.facebook.com/me"); | |
static readonly Uri FacebookAccessTokenBaseUri = new Uri("https://graph.facebook.com/oauth/access_token"); | |
readonly string _facebookAppId; | |
readonly string _facebookAppSecret; | |
public OAuthFacebookMessageHandler(string appId, string secret) { | |
_facebookAppId = appId; | |
_facebookAppSecret = secret; |