예제 #1
0
파일: Program.cs 프로젝트: arifiskilip/Try
 //EducatorManager
 private static void EducatorDelete()
 {
     try
     {
         EducatorGetAll();
         IEducatorService service = new EducatorManager(new EfEducatorDal());
         service.DeleteById(ToId());
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex.Message);
     }
 }
예제 #2
0
파일: Program.cs 프로젝트: arifiskilip/Try
 private static void EducatorGetAll()
 {
     try
     {
         IEducatorService service = new EducatorManager(new EfEducatorDal());
         foreach (var item in service.GetAll())
         {
             Console.WriteLine(item.Id + " " + item.Name + " " + item.Surname);
         }
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex.Message);
     }
     Console.ReadLine();
 }
예제 #3
0
파일: Program.cs 프로젝트: arifiskilip/Try
 public static void EducatorUpdate()
 {
     try
     {
         IEducatorService service = new EducatorManager(new EfEducatorDal());
         service.Update(new Educator()
         {
             Id = ToId(), Name = ToName(), Surname = ToSurname()
         });
         Console.WriteLine("Update succesful");
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex.Message);
     }
 }
예제 #4
0
파일: Program.cs 프로젝트: arifiskilip/Try
 private static void EducatorAdd()
 {
     try
     {
         IEducatorService service = new EducatorManager(new EfEducatorDal());
         int id; string name, surname;
         Console.Write("Please to ıd=");
         id = Convert.ToInt16(Console.ReadLine());
         Console.Write("Please to Name=");
         name = Console.ReadLine();
         Console.WriteLine("Please to surname=");
         surname = Console.ReadLine();
         service.Add(new Educator {
             Id = id, Name = name, Surname = surname
         });
         Console.WriteLine("Succes");
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex.Message);
     }
 }
예제 #5
0
파일: Program.cs 프로젝트: arifiskilip/Try
 private static void CourEduAdd()
 {
     try
     {
         ICourEduService  service = new CourEduManager(new EfCourEduDal());
         ICourseService   a = new CourseManager(new EfCourseDal());
         IEducatorService b = new EducatorManager(new EfEducatorDal());
         int x = 0, courseıd, educatorıd;
         courseıd   = ToCourseId();
         educatorıd = ToEducatorId();
         foreach (var item in a.GetById(courseıd))
         {
             foreach (var item2 in b.GetById(educatorıd))
             {
                 x += 1;
             }
         }
         if (x == 1) // true
         {
             Console.WriteLine("Enter ıd");
             service.Add(new CourEdu()
             {
                 Id = ToId(), CoursId = courseıd, EducatorsId = educatorıd
             });
             Console.WriteLine("Success");
         }
         else // false
         {
             Console.WriteLine("İnsertion failed!!!");
         }
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex.Message);
     }
 }