Skip to content

Instantly share code, notes, and snippets.

@mishuagopian
Created June 19, 2017 21:24
Show Gist options
  • Save mishuagopian/69693d2ad21f382e8c1d0c12596b14fe to your computer and use it in GitHub Desktop.
Save mishuagopian/69693d2ad21f382e8c1d0c12596b14fe to your computer and use it in GitHub Desktop.
Net Core Training - MVC - Models
// Models/DataBaseContext.cs
#region Using
using Microsoft.EntityFrameworkCore;
using MvcMovie.Models;
#endregion
namespace MvcMovie.Models
{
public class DataBaseContext : DbContext
{
public DataBaseContext(DbContextOptions<DataBaseContext> options) : base(options) {}
public DbSet<Movie> Movies { get; set; }
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
base.OnModelCreating(modelBuilder);
}
}
}
// Models/Movie.cs
using System;
namespace MvcMovie.Models
{
public class Movie
{
public int ID { get; set; }
public string Title { get; set; }
public DateTime ReleaseDate { get; set; }
public string Genre { get; set; }
public decimal Price { get; set; }
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment