This file contains hidden or 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 serializer = new MyJsonSerializer(); | |
| GlobalHost.DependencyResolver.Register(typeof(IJsonSerializer), () => serializer); |
This file contains hidden or 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 settings = new JsonSerializerSettings(); | |
| settings.ContractResolver = new SignalRContractResolver(); | |
| var serializer = new JsonNetSerializer(settings); | |
| GlobalHost.DependencyResolver.Register(typeof (IJsonSerializer), () => serializer); |
This file contains hidden or 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 parseValues = function (data, callback, prefix, postfix) { | |
| postfix = postfix || ""; | |
| prefix = prefix || ""; | |
| for (var key in data) { | |
| if (data[key] == null) { | |
| continue; | |
| } | |
| if ( Object.prototype.toString.call( data[key] ) === '[object Array]') { | |
| parseValues(data[key], callback, prefix + key + postfix + "[", "]"); | |
| } else if (typeof data[key] == "object") { |
This file contains hidden or 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 Newtonsoft.Json; | |
| namespace System.Web.Mvc | |
| { | |
| public static class HtmlHelperExt | |
| { | |
| private const string BaseApplyModelScriptString = @"<script type=""text/javascript""> | |
| $(function () {{ | |
| var model = new AllMessagesModel({0}); | |
| ko.applyBindings(model); |
This file contains hidden or 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 AmazonS3Helper | |
| { | |
| private readonly string _amazonAccessKey; | |
| private readonly string _amazonSecretKey; | |
| private const string BucketName = "zertisedpm"; | |
| public AmazonS3Helper(string amazonAccessKey, string amazonSecretKey ) | |
| { | |
| _amazonAccessKey = amazonAccessKey; | |
| _amazonSecretKey = amazonSecretKey; |
This file contains hidden or 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 sendJson = function(url, json, callback){ | |
| var data = {}; | |
| parseValues(json, function(key, value) { | |
| data[key] = value; | |
| }); | |
| $.post(url, data,callback); | |
| }; | |
| var parseValues = function (data, callback, prefix, postfix) { |
This file contains hidden or 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 sendModel = function (url, model, successCallback, ignoreList) { | |
| model.Loading(true); | |
| var mapping = { | |
| ignore: ignoreList | |
| }; | |
| sendJson(url, ko.mapping.toJS(model,mapping), function(response) { | |
| var defaultBehaviour = true; | |
| if (successCallback) { | |
| var result = successCallback(response); | |
| if (result === false) { |
This file contains hidden or 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 JsonResult JsonModel<T>(T model) where T : BaseViewModel | |
| { | |
| model.Errors = GetErorsModel().ToList(); | |
| return Json(model); | |
| } | |
| protected IEnumerable<ValidationError> GetErorsModel() | |
| { | |
| foreach (var state in ModelState) | |
| { |
This file contains hidden or 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
| [POST] | |
| public JsonResult UploadImage(HttpPostedFileBase uploadedFile) | |
| { | |
| var cloudinary = new CloudinaryDotNet.Cloudinary(ConfigurationManager.AppSettings.Get("cloudinary_url")); | |
| bool isValidImage; | |
| if (uploadedFile != null) | |
| { | |
| isValidImage = uploadedFile.IsValidImage(250, 250); | |
| } |
This file contains hidden or 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 struct Location : IBsonSerializable | |
| { | |
| public const double LatitudeMinValue = -90; | |
| public const double LatitudeMaxValue = 90; | |
| public const double LongitudeMinValue = -180; | |
| public const double LongitudeMaxValue = 180; | |
| private const double PIx = 3.141592653589793; | |
| public const double EarthRaduisInKm = 6378.16; | |
| public const double EarthRaduisInMiles = 3959; |
OlderNewer