Пример #1
0
 /// <summary>
 /// Maps BllSubject entity to  DalSubject entity.
 /// </summary>
 /// <param name="subject"> BllSubject instance.</param>
 /// <returns> DalSubject instance.</returns>
 public static DalSubject ToDalSubject(this BllSubject subject)
 {
     return(new DalSubject()
     {
         Id = subject.Id,
         Name = subject.Name
     });
 }
Пример #2
0
 /// <summary>
 /// Maps BllSubject entity to SubjectViewModel.
 /// </summary>
 /// <param name="subject"> BllSubject instance.</param>
 /// <returns> SubjectViewModel instance.</returns>
 public static SubjectViewModel ToSubjectViewModel(this BllSubject subject)
 {
     return(new SubjectViewModel
     {
         Id = subject.Id,
         Name = subject.Name
     });
 }
 /// <summary>
 /// Gets tests for specified subject.
 /// </summary>
 /// <param name="subject"> Subject instance.</param>
 /// <returns> Tests created by specified subject.</returns>
 public IEnumerable <BllTest> GetTestsBySubject(BllSubject subject)
 {
     if (subject == null)
     {
         throw new ArgumentNullException(nameof(subject));
     }
     return(repository.GetByPredicate(t => t.Subject.Id == subject.Id).Select(t => t.ToBllTest()));
 }