public async Task <ViewModels.ActiveCourseSummary> GetActiveCourseSummary(int id)
        {
            var course   = new ViewModels.ActiveCourse();
            var dbcourse = await context.ViewCourseNotificationEnableds.Where(q => q.Id == id).Select(q => new
            {
                q.Total,
                q.Passed,
                q.Failed,
                q.Registered,
                q.Pending,
                q.Attended,
                q.Canceled
            }).FirstAsync();

            var dto = new ViewModels.ActiveCourseSummary()
            {
                Attended   = dbcourse.Attended,
                Canceled   = dbcourse.Canceled,
                Registered = dbcourse.Registered,
                Pending    = dbcourse.Pending,
                Failed     = dbcourse.Failed,
                Passed     = dbcourse.Passed,
                Total      = dbcourse.Total,
            };

            return(dto);
        }
        public async Task <ViewModels.ActiveCourse> GetActiveCourseDto(int id)
        {
            var course   = new ViewModels.ActiveCourse();
            var dbcourse = await context.ViewCourseNotificationEnableds.FirstOrDefaultAsync(q => q.Id == id);

            ViewModels.ActiveCourse.FillDto(dbcourse, course);
            course.ApplicablePeople = await context.ViewApplicableCoursePersons.Where(q => q.CourseId == course.Id).ToListAsync();

            return(course);
        }
Beispiel #3
0
 public static void FillDto(Models.ViewCourseNotificationEnabled entity, ViewModels.ActiveCourse activeCourse)
 {
     activeCourse.Id = entity.Id;
     activeCourse.No = entity.No;
     activeCourse.IsNotificationEnabled = entity.IsNotificationEnabled;
     activeCourse.CourseTypeId          = entity.CourseTypeId;
     activeCourse.DateStart             = entity.DateStart;
     activeCourse.DateStartP            = entity.DateStartP;
     activeCourse.DateEnd                   = entity.DateEnd;
     activeCourse.DateEndP                  = entity.DateEndP;
     activeCourse.Instructor                = entity.Instructor;
     activeCourse.Location                  = entity.Location;
     activeCourse.Department                = entity.Department;
     activeCourse.OrganizationId            = entity.OrganizationId;
     activeCourse.Duration                  = entity.Duration;
     activeCourse.DurationUnitId            = entity.DurationUnitId;
     activeCourse.StatusId                  = entity.StatusId;
     activeCourse.Remark                    = entity.Remark;
     activeCourse.Capacity                  = entity.Capacity;
     activeCourse.Tuition                   = entity.Tuition;
     activeCourse.CurrencyId                = entity.CurrencyId;
     activeCourse.DateDeadlineRegistration  = entity.DateDeadlineRegistration;
     activeCourse.DateDeadlineRegistrationP = entity.DateDeadlineRegistrationP;
     activeCourse.TrainingDirector          = entity.TrainingDirector;
     activeCourse.Title                   = entity.Title;
     activeCourse.AircraftTypeId          = entity.AircraftTypeId;
     activeCourse.AircraftModelId         = entity.AircraftModelId;
     activeCourse.CaoTypeId               = entity.CaoTypeId;
     activeCourse.Recurrent               = entity.Recurrent;
     activeCourse.Interval                = entity.Interval;
     activeCourse.CalanderTypeId          = entity.CalanderTypeId;
     activeCourse.IsInside                = entity.IsInside;
     activeCourse.Quarantine              = entity.Quarantine;
     activeCourse.DateStartPractical      = entity.DateStartPractical;
     activeCourse.DateEndPractical        = entity.DateEndPractical;
     activeCourse.DateStartPracticalP     = entity.DateStartPracticalP;
     activeCourse.DateEndPracticalP       = entity.DateEndPracticalP;
     activeCourse.DurationPractical       = entity.DurationPractical;
     activeCourse.DurationPracticalUnitId = entity.DurationPracticalUnitId;
     activeCourse.CT_CalendarTypeId       = entity.CT_CalendarTypeId;
     activeCourse.CT_Title                = entity.CT_Title;
     activeCourse.CT_LicenseResultBasicId = entity.CT_LicenseResultBasicId;
     activeCourse.CT_Remark               = entity.CT_Remark;
     activeCourse.CT_CourseCategoryId     = entity.CT_CourseCategoryId;
     activeCourse.CT_Interval             = entity.CT_Interval;
     activeCourse.CT_IsGeneral            = entity.CT_IsGeneral;
     activeCourse.CT_Status               = entity.CT_Status;
     activeCourse.CT_Id                   = entity.CT_Id;
     activeCourse.CC_Title                = entity.CC_Title;
     activeCourse.CaoTypeTitle            = entity.CaoTypeTitle;
     activeCourse.CaoTypeRemark           = entity.CaoTypeRemark;
     activeCourse.Organization            = entity.Organization;
     activeCourse.DurationUnit            = entity.DurationUnit;
     activeCourse.Duration2               = entity.Duration2;
     activeCourse.Status                  = entity.Status;
     activeCourse.Currency                = entity.Currency;
     activeCourse.AircraftType            = entity.AircraftType;
     activeCourse.Manufacturer            = entity.Manufacturer;
     activeCourse.ManufacturerId          = entity.ManufacturerId;
     activeCourse.AircraftModel           = entity.AircraftModel;
     activeCourse.CalendarType            = entity.CalendarType;
     activeCourse.DurationPracticalUnit   = entity.DurationPracticalUnit;
     activeCourse.Remain                  = entity.Remain;
     activeCourse.ExpireDate              = entity.ExpireDate;
     activeCourse.IsGeneral               = entity.IsGeneral;
     activeCourse.CustomerId              = entity.CustomerId;
     activeCourse.RemainRegistration      = entity.RemainRegistration;
     activeCourse.Total                   = entity.Total;
     activeCourse.Pending                 = entity.Pending;
     activeCourse.Registered              = entity.Registered;
     activeCourse.Attended                = entity.Attended;
     activeCourse.Canceled                = entity.Canceled;
     activeCourse.Failed                  = entity.Failed;
     activeCourse.Passed                  = entity.Passed;
 }