Skip to content

Instantly share code, notes, and snippets.

@danielplawgo
danielplawgo / GetWithLazy.txt
Last active May 21, 2018 07:32
Wstrzykiwanie zależności z wykorzystaniem Lazy
Activating: System.Lazy`1[DependencyInjectionWithLazy.Logics.IUserLogic]
Activating: DependencyInjectionWithLazy.Controllers.UsersController
Before call controller: Users.create (GET)
After call controller: Users.create (GET)
@danielplawgo
danielplawgo / InvoiceLogic.cs
Last active May 17, 2018 08:06
Własny filtr akcji – autoryzacja z wykorzystaniem logiki biznesowej
public bool HasAccess(ApplicationUser user, Invoice entity)
{
if(user == null)
{
throw new ArgumentNullException("user");
}
if(entity == null)
{
throw new ArgumentNullException("entity");
@danielplawgo
danielplawgo / FilterConfig.cs
Last active May 16, 2018 06:29
Filtry Akcji – ASP.NET MVC
public class FilterConfig
{
public static void RegisterGlobalFilters(GlobalFilterCollection filters)
{
filters.Add(new HandleErrorAttribute());
}
}
@danielplawgo
danielplawgo / RegisterUser.cshtml
Created April 24, 2018 08:49
Send Emails with Hangfire and Postal
@model HangfireAndPostal.Models.RegisterUserEmail
To: @Model.Email
Subject: New Account
<h1>Hi @Model.FirstName!</h1>
<p>Thank you for creating an account.</p>