49 lines
1.3 KiB
C#
49 lines
1.3 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel.DataAnnotations;
|
|
using Microsoft.AspNetCore.Mvc.ModelBinding;
|
|
|
|
namespace MusicStore.Models
|
|
{
|
|
public class Album
|
|
{
|
|
[ScaffoldColumn(false)]
|
|
public int AlbumId { get; set; }
|
|
|
|
public int GenreId { get; set; }
|
|
|
|
public int ArtistId { get; set; }
|
|
|
|
[Required]
|
|
[StringLength(160, MinimumLength = 2)]
|
|
public string Title { get; set; }
|
|
|
|
[Required]
|
|
[Range(0.01, 100.00)]
|
|
|
|
[DataType(DataType.Currency)]
|
|
public decimal Price { get; set; }
|
|
|
|
[Display(Name = "Album Art URL")]
|
|
[StringLength(1024)]
|
|
public string AlbumArtUrl { get; set; }
|
|
|
|
public virtual Genre Genre { get; set; }
|
|
public virtual Artist Artist { get; set; }
|
|
public virtual List<OrderDetail> OrderDetails { get; set; }
|
|
|
|
[ScaffoldColumn(false)]
|
|
[BindNever]
|
|
[Required]
|
|
public DateTime Created { get; set; }
|
|
|
|
/// <summary>
|
|
/// TODO: Temporary hack to populate the orderdetails until EF does this automatically.
|
|
/// </summary>
|
|
public Album()
|
|
{
|
|
OrderDetails = new List<OrderDetail>();
|
|
Created = DateTime.UtcNow;
|
|
}
|
|
}
|
|
} |