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 AddOrder : DbMigration | |
{ | |
public override void Up() | |
{ | |
CreateTable( | |
"dbo.Orders", | |
c => new | |
{ | |
Id = c.Int(nullable: false, identity: true), | |
Number = 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
public partial class AddDescriptionToProduct : DbMigration | |
{ | |
public override void Up() | |
{ | |
AddColumn("dbo.Products", "Description", c => c.String()); | |
//AddColumn("dbo.ProductsHistory", "Description", c => c.String()); | |
} | |
public override void Down() | |
{ |
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.Products | |
( | |
[Id] int IDENTITY(1,1) PRIMARY KEY, | |
[Name] nvarchar(250) NOT NULL, | |
[Description] varchar(max) NULL, | |
[ValidFrom] datetime2 (2) GENERATED ALWAYS AS ROW START, | |
[ValidTo] datetime2 (2) GENERATED ALWAYS AS ROW END, | |
PERIOD FOR SYSTEM_TIME (ValidFrom, ValidTo) | |
) | |
WITH (SYSTEM_VERSIONING = ON (HISTORY_TABLE = dbo.ProductsHistory)); |
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
private Audit ConfigureAudit() | |
{ | |
var audit = new Audit(); | |
audit.CreatedBy = UserName; | |
audit.Configuration.Exclude<Product>(); | |
return audit; | |
} |
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 DataContext : DbContext | |
{ | |
public DataContext() | |
: base("Name=DefaultConnection") | |
{ | |
} | |
public DbSet<Category> Categories { get; set; } |
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 DownloadViewModel | |
{ | |
[Required] | |
public string Url { get; set; } | |
} |
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 HomeController : Controller | |
{ | |
private static ILogger _logger = NLog.LogManager.GetCurrentClassLogger(); | |
public ActionResult Index() | |
{ | |
_logger.Info("Home.Index started."); | |
Random random = new Random(); | |
var value = random.Next(1, 3); |
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 Product | |
{ | |
public int Id { get; set; } | |
public string Name { get; set; } | |
public string Category { get; set; } | |
public decimal Price { get; set; } | |
} |
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 Category | |
{ | |
public int Id { get; set; } | |
public string Name { get; set; } | |
public string Description { get; set; } | |
public virtual ICollection<Product> Products { get; set; } | |
} |
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 Category | |
{ | |
public int Id { get; set; } | |
public string Name { get; set; } | |
} |