init
This commit is contained in:
commit
e124a47765
19374 changed files with 9806149 additions and 0 deletions
|
@ -0,0 +1,32 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Linq;
|
||||
using Kreta.Naplo.Domain.V3.Interfaces;
|
||||
|
||||
namespace Kreta.Naplo.Domain.V3.HaziFeladat
|
||||
{
|
||||
public class HaziFeladatCreateRequest : IValidatableObject, IModelValidacio<HaziFeladatCreateRequest>
|
||||
{
|
||||
public string Szoveg { get; set; }
|
||||
|
||||
public DateTime BeadasiHatarido { get; set; }
|
||||
|
||||
public DateTime OraDatum { get; set; }
|
||||
|
||||
public int? Oraszam { get; set; }
|
||||
|
||||
public int TantargyId { get; set; }
|
||||
|
||||
public int OsztalyCsoportId { get; set; }
|
||||
|
||||
public Dictionary<Predicate<HaziFeladatCreateRequest>, string> ModelValidaciok => new Dictionary<Predicate<HaziFeladatCreateRequest>, string>
|
||||
{
|
||||
{ x => string.IsNullOrWhiteSpace(x.Szoveg), "Házi feladat szövege nem lehet üres!" },
|
||||
{ x => x.BeadasiHatarido < DateTime.Today.AddDays(1), "Házi feladat nem rögzíthető korábbi határidővel, mint a holnapi!" },
|
||||
{ x => x.BeadasiHatarido < x.OraDatum, "Házi feladat határideje nem lehet korábban, mint az óra dátuma!" }
|
||||
};
|
||||
|
||||
public IEnumerable<ValidationResult> Validate(ValidationContext validationContext) => ModelValidaciok.Where(x => x.Key.Invoke(this)).AsEnumerable().Select(x => new ValidationResult(x.Value));
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue