public IActionResult Add([FromQuery] LessonStudentViewModel model) { var LessonStudentResponse = _LessonStudentService.Add(new LessonStudent { LessonId = model.LessonId, StudentId = model.StudentId }); if (LessonStudentResponse.IsSucceeded && LessonStudentResponse.Result != null) { return(Ok(LessonStudentResponse.Result)); } return(LessonStudentResponse.HttpGetResponse()); }
public IActionResult Edit(int id, LessonStudentViewModel model) { var getLessonStudent = _LessonStudentService.GetLessonStudentById(id); if (getLessonStudent != null && getLessonStudent.IsSucceeded) { getLessonStudent.Result.StudentId = model.StudentId; getLessonStudent.Result.LessonId = model.LessonId; var updateResult = _LessonStudentService.Update(getLessonStudent.Result); if (updateResult.IsSucceeded) { return(Ok(updateResult.Result)); } return(updateResult.HttpGetResponse()); } return(getLessonStudent.HttpGetResponse()); }