public ServiceResponse <Infra.Data.Entity.LessonStudent> Add(Infra.Data.Entity.LessonStudent lessonStudent) { var response = new ServiceResponse <LessonStudent>(); if (response.Validation(new LessonStudentValidation().Validate(lessonStudent))) { response.Result = lessonStudentRepository.Insert(lessonStudent); } return(response); }
public ServiceResponse <Infra.Data.Entity.LessonStudent> Update(Infra.Data.Entity.LessonStudent lessonStudent) { var response = new ServiceResponse <LessonStudent>(); if (response.Validation(new LessonStudentValidation().Validate(lessonStudent))) { lessonStudentRepository.Detach(lessonStudent); var repositoryResponse = lessonStudentRepository.GetById(lessonStudent.Id); if (repositoryResponse != null) { repositoryResponse.LessonId = lessonStudent.LessonId; repositoryResponse.StudentId = lessonStudent.StudentId; response.Result = lessonStudentRepository.Update(repositoryResponse); } else { response.SetError("Veri Bulunamadı"); } } return(response); }