//EducatorManager private static void EducatorDelete() { try { EducatorGetAll(); IEducatorService service = new EducatorManager(new EfEducatorDal()); service.DeleteById(ToId()); } catch (Exception ex) { Console.WriteLine(ex.Message); } }
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(); }
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); } }
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); } }
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); } }