Skip to content

Instantly share code, notes, and snippets.

View gist:a5d314ead821f66a82a6db3ac71e2c42
public class MyModel {
public string Prop1 { get; set; }
public string Prop2 { get; set; }
[DataType.Date]
public string Prop3 { get; set; }
View example.json
{
"data": {
"mobile_numbers": [
{ "number": "+44 (0)07779288893" },
{ "number": "+44 (0)07779288893" }
],
"email_addresses": [
{"address":"me@there.com"},
{"address":"you@there.com"}
View TransactionRequestValidator.cs
using FluentValidation;
using FluentValidation.Results;
using Vanquis.Digital.Services.WebAPI.Requests;
using Microsoft.Extensions.Options;
using Vanquis.Digital.Services.WebAPI.Helper;
namespace Vanquis.Digital.Services.WebAPI.ModelValidators
{
public class TransactionRequestValidator : AbstractValidator<TransactionsRequest>
{
View timetakenmiddleware.cs
public async Task Invoke(HttpContext context)
{
var stopWatch = new Stopwatch();
stopWatch.Start();
context.Response.OnStarting(_ =>
{
((HttpContext)_).Response.Headers["X-Instrumentation-Time-Elapsed-Ms"] = stopWatch.ElapsedMilliseconds.ToString();
return Task.FromResult(0);
}, context);
View import.cs
//ImportSessionContext?
public class ImportSession : IImportSession
{
private readonly IImportSessionRepository _importSessionRepository;
public ImportSession(IImportSessionRepository importSessionRepository)
{
_importSessionRepository = importSessionRepository;
}
View gist:5254318
public void SendTemplate(/* to decide: TemplateId, Parameters */)
{
/*
- Get any flow with this template (Flow name, Flow Parameters)
- Get FlowOrderId of template on Flow
- Update Flow parameter values with parameters passed by user
- Update special parameters (email, sms)
- CreateSchedule
- Send Schedule for particular template
View gist:5246100
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Vanquis.Services.Communication.Contracts.ServiceContracts
{
//Templates
public interface ITemplateService
View gist:4996871
ProspectBasedUserAuthenticationService
2) Injection of dependency IUserAuthenticationService into parameter authenticationService of constructor of type UsersController
1) Request for UsersController
Suggestions:
View gist:4986794
public static IMappingExpression<TSource, TDestination> IgnoreAllNonExisting<TSource, TDestination>(this IMappingExpression<TSource, TDestination> expression)
{
var sourceType = typeof(TSource);
var destinationType = typeof(TDestination);
var existingMaps = Mapper.GetAllTypeMaps();
var first = existingMaps.First(x => x.SourceType == sourceType && x.DestinationType == destinationType);
foreach (var property in first.GetUnmappedPropertyNames())
{
View gist:4771138
namespace Vanquis.NewBusiness.Loans.Services.Tests.Utils
{
public class ExpectArugmentNullExceptionAttribute : ExpectedExceptionAttribute
{
public ExpectArugmentNullExceptionAttribute(string message)
: base(typeof(ArgumentNullException))
{
ExpectedMessage = message;
MatchType = MessageMatch.Contains;