private void LoadGridLesson() { textBlockIdLesson.Text = ""; textBoxNameLesson.Text = ""; comboBoxLevelLesson.Text = ""; comboBoxDepartmentLesson.Text = ""; dataGridLesson.ItemsSource = _lessonService.Get(); }
public async Task <ActionResult <Lesson> > Get(Guid id) { var lesson = await _lessons.Get(id, HttpContext.RequestAborted); if (lesson == null) { return(NotFound()); } return(lesson); }
// GET: api/Lessons public HttpResponseMessage GetLessons() { var message = Request.CreateErrorResponse(HttpStatusCode.NotFound, "Data Not Found in the Database"); var get = _iLessonService.Get(); if (get != null) { message = Request.CreateResponse(HttpStatusCode.OK, get); return(message); } return(message); }
// GET: Lessons/Details/5 public IActionResult Details(Guid id) { if (id == null || id == Guid.Empty) { return(NotFound()); } var lesson = _lessonService.Get(id); if (lesson == null) { return(NotFound()); } ResultViewModel <LessonDto> lessonViewModel = AutoMapper.Mapper.Map <ResultHandler <LessonDto>, ResultViewModel <LessonDto> >(lesson); return(View(lessonViewModel)); }
public IActionResult Get(int id) { try { return(Ok(_lessonService.Get(id).ToApiModel())); } catch (Exception ex) { ModelState.AddModelError("GetBlog", ex.Message); return(BadRequest(ModelState)); } }
public TimeTable CreateTimeTable(CreateTimeTableDTO createTimeTable) { var subject = SubjectService.Get(SubjectService.GetAll().FirstOrDefault(x => x.Name == createTimeTable.Subject).Id); var timeTable = new TimeTable() { NameWeek = createTimeTable.NameWeek, Lesson = LessonService.Get(LessonService.GetAll().FirstOrDefault(x => x.Cabinet == createTimeTable.Cabiten && x.Subject == subject).Id), NumberLesson = NumberLessonService.Get(NumberLessonService.GetAll().FirstOrDefault(x => x.Number == createTimeTable.Pair).Id) }; Create(timeTable); return(timeTable); }
public SignUpPersonLesson AddStudentOnLesson(AddPersonOnLessonDTO addPersonOnLesson) { var sub = SubjectService.Get(SubjectService.GetAll().FirstOrDefault(x => x.Name == addPersonOnLesson.Subject).Id); var record = new SignUpPersonLesson() { Person = PersonService.Get(PersonService.GetAll() .FirstOrDefault(x => x.FirstName == addPersonOnLesson.FirstName && x.LastName == addPersonOnLesson.LastName).Id), Lesson = LessonService.Get(LessonService.GetAll() .FirstOrDefault(x => x.Cabinet == addPersonOnLesson.Cabinet && x.Subject == sub).Id) }; Create(record); return(record); }
public IActionResult Lessons(int id) { var lesson = lessonService.Get(id); if (lesson != null) { var course = courseService.Get(lesson.CourseId); LessonViewModel lessonView = new LessonViewModel(); lessonView.NameLesson = lesson.NameLesson; lessonView.Material = lesson.Material; lessonView.NameCourse = course.Name; return(View(lessonView)); } return(View(nameof(Index))); }
public ActionResult <LessonBO> Get(int id) { return(Ok(_lessonService.Get(id))); }
public async Task <IHttpActionResult> Get(string name = null) { var result = await _lessonService.Get(name); return(Ok(result)); }
public JsonResult GetLesson(int id) { return(Json( _lessonService.Get(id) )); }
public ActionResult Edit(int id) { var model = lessonService.Get(id); return(View(model)); }
// GET: LessonsController/Edit/5 public ActionResult Edit(int id) { ViewData["CourseId"] = new SelectList(courseService.GetAll(), "CourseId", "Name"); return(View(lessonService.Get(id))); }
// GET: api/Lesson/5 public Lesson Get(int id) { return(_lessonService.Get(id)); }
public ActionResult Details(string id) { Lesson lesson = _lessonRepository.Get(id); return(View(lesson)); }
public void Get_AddLessons_expect_Get2EqualToLessons1() { //Arrange Teacher teacher = new Teacher { Name = "Roman", Surname = "Kutsenko", Post = "Teacher", Lessons = new List <Lesson>() }; Group group = new Group { CourseNumber = 1, GroupNumber = 19, Lessons = new List <Lesson>() }; Lesson[] lessons = { new Lesson { WeekNumber = Week.FirstWeek, DayOfTheWeek = Day.Thursday, LessonNumber = 1, LessonName = "Programming", Group = group, Teacher = teacher }, new Lesson { WeekNumber = Week.SecondWeek, DayOfTheWeek = Day.Monday, LessonNumber = 3, LessonName = "Math", Group = group, Teacher = teacher }, new Lesson { WeekNumber = Week.FirstWeek, DayOfTheWeek = Day.Tuesday, LessonNumber = 3, LessonName = "Philosophy", Group = group, Teacher = teacher } }; Mock <ILessonService> service = new Mock <ILessonService>(); service.Setup(mock => mock.Get(1)).Returns(lessons[0]); service.Setup(mock => mock.Get(2)).Returns(lessons[1]); service.Setup(mock => mock.Get(3)).Returns(lessons[2]); Lesson expected = lessons[1]; int id = 2; //Act ILessonService Service = service.Object; Lesson actual = Service.Get(id); //Assert Assert.AreEqual(expected, actual); }