Skip to content
Snippets Groups Projects
Commit a7254242 authored by esantangelo's avatar esantangelo
Browse files

delete grade entity

parent 7eb99b91
No related branches found
No related tags found
1 merge request!37Feature/evaluation
using System;
using System.Collections.Generic;
using System.Text;
using System.Text.Json.Serialization;
namespace Tsi1.BusinessLayer.Dtos
{
public class GradeDto
{
public int ActivityId { get; set; }
public int UserId { get; set; }
public decimal Value { get; set; }
}
}
using System;
using System.Collections.Generic;
using System.Text;
namespace Tsi1.DataLayer.Entities
{
public class Grade
{
public int ActivityId { get; set; }
public int StudentId { get; set; }
public decimal Value { get; set; }
public DateTime Date { get; set; }
public Student Student { get; set; }
public Activity Activity { get; set; }
}
}
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using System;
using System.Collections.Generic;
using System.Text;
using Tsi1.DataLayer.Entities;
namespace Tsi1.DataLayer.EntityConfiguration
{
public class GradeConfiguration : IEntityTypeConfiguration<Grade>
{
public void Configure(EntityTypeBuilder<Grade> builder)
{
builder.HasKey(x => new { x.ActivityId, x.StudentId});
builder.Property(x => x.Value)
.IsRequired()
.HasColumnType("NUMERIC(5,2)");
builder.HasOne(x => x.Activity)
.WithMany(x => x.Grades)
.HasForeignKey(x => x.ActivityId);
builder.HasOne(x => x.Student)
.WithMany(x => x.Grades)
.HasForeignKey(x => x.StudentId);
}
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment