Пример #1
0
        static void Main(string[] args)
        {
            IAppErrors     errors  = new AppErrors();
            IExamService   service = new ExamService(errors, new ExamRepository());
            ExaminationDTO ex      = new ExaminationDTO();

            ex.Description = "Data By EF";
            ex.CutOffMark  = 24;
            ex.CourseID    = 1;
            service.AddNewExam(ex);

            if (errors.IsValid)
            {
                Console.WriteLine("Success");
            }
            else
            {
                foreach (Error er in errors.GetErrors())
                {
                    Console.WriteLine(er.Value);
                }
            }

            IEnumerable <ExaminationDTO> exams = service.GetExams();

            foreach (var x in exams)
            {
                Console.WriteLine(x.CourseID + "|" + x.Description + "|" + x.CutOffMark);
            }
            Console.ReadLine();
        }
Пример #2
0
        static void Main(string[] args)
        {
            IAppErrors   errors  = new AppErrors();
            IExamService service = new ExamService(errors, new ExamRepository());
            Examination  ex      = new Examination();

            ex.Description = "Data By ADO.NET";
            ex.CutOffMark  = 24;
            ex.CourseID    = 1;
            service.AddNewExam(ex);

            if (errors.IsValid)
            {
                Console.WriteLine("Success");
            }
            else
            {
                foreach (Error er in errors.GetErrors())
                {
                    Console.WriteLine(er.Value);
                }
            }
            Console.ReadLine();
        }