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 CacheInterceptor : IInterceptor | |
{ | |
private ICacheService _cacheService; | |
public CacheInterceptor(ICacheService cacheService) | |
{ | |
_cacheService = cacheService; | |
} | |
public void Intercept(IInvocation invocation) |
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 CategoriesController : Controller | |
{ | |
private Lazy<ICategoryRepository> _categoryRepository; | |
protected ICategoryRepository CategoryRepository | |
{ | |
get { return _categoryRepository.Value; } | |
} | |
private Lazy<IMapper> _mapper; |
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 interface IVerb | |
{ | |
void Run(); | |
} |
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 partial class AddCategory : DbMigration | |
{ | |
public override void Up() | |
{ | |
CreateTable( | |
"dbo.Categories", | |
c => new | |
{ | |
Id = c.Int(nullable: false, identity: true), | |
Name = c.String(), |
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
[Migration(201810030717)] | |
public class AddCategory : Migration | |
{ | |
public override void Up() | |
{ | |
Create.Table("Categories") | |
.WithColumn("Id").AsInt32().NotNullable().PrimaryKey().Identity() | |
.WithColumn("Name").AsString(); | |
Execute.Sql("INSERT INTO dbo.Categories SELECT DISTINCT Category FROM dbo.Products;"); |
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
CREATE TABLE [dbo].[Categories] ( | |
[Id] INT NOT NULL IDENTITY(1,1), | |
[Name] NVARCHAR(255) NOT NULL, | |
CONSTRAINT [PK_Categories] PRIMARY KEY ([Id]) | |
) | |
INSERT INTO dbo.Categories SELECT DISTINCT Category FROM dbo.Products; | |
ALTER TABLE [dbo].[Products] ADD [CategoryId] INT |
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
/// <summary> | |
/// The product. | |
/// </summary> | |
public class Product | |
{ | |
/// <summary> | |
/// Gets or sets the identifier. | |
/// </summary> | |
/// <value> | |
/// The identifier. |
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 static class ControllerExtensions | |
{ | |
public static string GetUserClaim(this ApiController controller, string claimName) | |
{ | |
var principal = controller.User as ClaimsPrincipal; | |
if (principal == null) | |
{ | |
return null; | |
} |
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
@model PartialForms.ViewModels.Shared.AddressViewModel | |
<div class="form-group"> | |
@Html.LabelFor(model => model.Street, htmlAttributes: new { @class = "control-label col-md-2" }) | |
<div class="col-md-10"> | |
@Html.EditorFor(model => model.Street, new { htmlAttributes = new { @class = "form-control" } }) | |
@Html.ValidationMessageFor(model => model.Street, "", new { @class = "text-danger" }) | |
</div> | |
</div> |
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 BaseModel | |
{ | |
public BaseModel() | |
{ | |
IsActive = true; | |
} | |
public int Id { get; set; } | |
public bool IsActive { get; set; } |