Skip to content

Instantly share code, notes, and snippets.

View hidegh's full-sized avatar

balazs HIDEGHETY hidegh

View GitHub Profile
public static MvcHtmlString PartialFor<TModel, TProperty>(
this HtmlHelper<TModel> helper,
System.Linq.Expressions.Expression<Func<TModel, TProperty>> expression,
string partialViewName,
Dictionary<string, object> additionalViewData = null
)
{
// Get model value from expression
string name = ExpressionHelper.GetExpressionText(expression);
public class BankingDetails
{
public string AccountNumber { get; set; }
public string RoutingTransitNumber { get; set; }
}
public class BankingDetails
{
protected string EncryptedAccountNumber { get; set; }
protected string EncryptedRoutingTransitNumber { get; set; }
public string GetAccountNumber (IDecryptor decryptor)
{
return string.IsNullOrWhitespace(EncryptedAccountNumber) ? "" : decryptor.Decrypt(EncryptedAccountNumber);
}
<UsingTask TaskName="TransformXml" AssemblyFile="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\Web\Microsoft.Web.Publishing.Tasks.dll" />
<Target Name="AfterCompile" Condition="Exists('App.$(Configuration).config')">
<!--Generate transformed app config in the intermediate directory-->
<TransformXml Source="App.config" Destination="$(IntermediateOutputPath)$(TargetFileName).config" Transform="App.$(Configuration).config" />
<!--Force build process to use the transformed configuration file from now on.-->
<ItemGroup>
<AppConfigWithTargetPath Remove="App.config" />
<AppConfigWithTargetPath Include="$(IntermediateOutputPath)$(TargetFileName).config">
<TargetPath>$(TargetFileName).config</TargetPath>
</AppConfigWithTargetPath>
<!-- CONFIG FILES -->
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<!-- ... -->
<ItemGroup>
<Content Include="Web.config" />
<None Include="Web.Base.config">
<SubType>Designer</SubType>
<UsingTask TaskName="TransformXml" AssemblyFile="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\Web\Microsoft.Web.Publishing.Tasks.dll" />
<Target Name="BeforeBuild">
<TransformXml Source="App.Base.config" Transform="App.Base.$(Configuration).config" Destination="App.config" />
</Target>
public IHttpActionResult SavePhoneSystems(long waiverId, IList<PhoneSystemModel> model)
{
var waiver = ReturnUnfinishedWaiverByIdForUser(waiverId);
// Save phone systems (with addresses)
using (var tx = TransactionScopeBuilder.New())
{
waiver.SetPhoneSystems(model);
waiver.MarkAsDataCompletelyEntered();
using System;
using System.Collections;
using System.Collections.Generic;
using System.Reflection;
using System.Text;
using System.Text.RegularExpressions;
namespace MyProject.Reporting.ExpressionResolver
{
/// <summary>
$(function () {
// on document ready...
if (typeof ko != "undefined" && typeof kendo != "undefined") {
// Extending original KO handlers to support kendo widgets...since knockout-kendo.js does not worked well in my tests...
var originalHandlerForValueUpdate = ko.bindingHandlers.value.update;
var originalHandlerForDisableUpdate = ko.bindingHandlers.disable.update;
var originalHandlerForEnableUpdate = ko.bindingHandlers.enable.update;
var originalHandlerForReadonlyUpdate = ko.bindingHandlers.readonly.update;
using System;
using System.Collections.Generic;
using System.Data.Entity;
using System.Data.Entity.ModelConfiguration;
using System.Linq;
using System.Reflection;
namespace EF6x_code_first_persistence.Mappings.Core
{
/// <summary>