Created
June 19, 2017 21:24
-
-
Save mishuagopian/69693d2ad21f382e8c1d0c12596b14fe to your computer and use it in GitHub Desktop.
Net Core Training - MVC - Models
This file contains 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
// 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); | |
} | |
} | |
} |
This file contains 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
// 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