public async Task <object> Delete(TeacherById request) { var response = new BaseResponse(); Expression <Func <Teacher, bool> > keySelector = x => x.Id == request.Id; var result = await _teacherService.Delete(keySelector : keySelector); response.Success = true; response.Message = $"Delete teacher with id {request.Id} success"; response.StatusCode = (int)HttpStatusCode.OK; response.Results = result.ConvertTo <TeacherDto>(); return(response); }
public async Task <object> Get(TeacherById request) { var response = new BaseResponse(); Expression <Func <Teacher, bool> > keySelector = x => x.Id == request.Id; var entity = await _teacherService.GetById(keySelector : keySelector); var dto = entity.ConvertTo <TeacherDto>(); response.Success = true; response.StatusCode = (int)HttpStatusCode.OK; response.Results = dto; return(response); }