Exemple #1
0
        /// <summary>
        ///     Data access to business object conversion
        /// </summary>
        /// <param name="service">Data access service</param>
        /// <returns>Business object single service</returns>
        public static DtoService ViewModelSingleServiceToDto(SingleService service)
        {
            var ret = new DtoService
            {
                Id                 = service.Id,
                ServiceTypeId      = service.ServiceTypeId,
                ServiceTypeName    = service.ServiceTypeName,
                InstructorId       = service.InstructorId,
                InstructorFullName = service.InstructorFullName,
                Dates              = new List <DateTime> {
                    service.Date
                },
                Customers = new List <DtoCustomer> {
                    CustomerConverter.ViewModelToDto(service.Customer)
                }
            };

            return(ret);
        }
Exemple #2
0
        /// <summary>
        ///     Data access to business object conversion
        /// </summary>
        /// <param name="service">Data access service</param>
        /// <returns>Business object course</returns>
        public static DtoService ViewModelCourseToDto(Course service)
        {
            var ret = new DtoService
            {
                Id                 = service.Id,
                ServiceTypeId      = service.ServiceTypeId,
                ServiceTypeName    = service.ServiceTypeName,
                InstructorId       = service.InstructorId,
                InstructorFullName = service.InstructorFullName,
                Dates              = new List <DateTime>(service.Dates)
            };
            var customers = service.Customers;

            ret.Customers = new List <DtoCustomer>();
            foreach (var c in customers)
            {
                ret.Customers.Add(CustomerConverter.ViewModelToDto(c));
            }
            return(ret);
        }