コード例 #1
0
 public static void ParseFromSanction(this SanctionDto result, Sanction sourse)
 {
     result.BrokenRule     = sourse.BrokenRule;
     result.UserId         = sourse.UserId;
     result.ModeratorId    = sourse.ModeratorId;
     result.IsTemporary    = sourse.IsTemporary;
     result.ExpirationDate = sourse.ExpirationDate;
     result.Type           = sourse.Type;
     result.IsActive       = sourse.IsActive;
 }
コード例 #2
0
 public void Add(Sanction sanction)
 {
     using (var context = new EduhubContext(_connectionString))
     {
         var sanctionDto = new SanctionDto();
         sanctionDto.ParseFromSanction(sanction);
         context.Sanctions.Add(sanctionDto);
         context.SaveChanges();
         sanction.Id = sanctionDto.Id;
     }
 }
コード例 #3
0
 public static Sanction ParseFromSanctionDto(SanctionDto source)
 {
     return(new Sanction(source.Id, source.BrokenRule, source.UserId,
                         source.ModeratorId, source.IsTemporary, source.ExpirationDate, source.Type, source.IsActive));
 }