public async Task <ResponseModel <Course> > CreateCourse(Course course) { return(await Task.Run(async() => { ResponseModel <Course> responseModel = new ResponseModel <Course>(); bool isSuccess = repositoryHelper.Course.CreateCourse(course); await repositoryHelper.SaveAsync(); if (isSuccess == true) { responseModel.StatusCode = HttpStatusCode.OK; responseModel.DataObject = course; responseModel.Message = ResponseMessage.OnSuccessSaveMessage; } else { responseModel.StatusCode = HttpStatusCode.BadRequest; responseModel.Message = ResponseMessage.OnErrorMessage; } return responseModel; })); }
public async Task <ResponseModel <Student> > CreateStudent(Student student) { return(await Task.Run(async() => { ResponseModel <Student> responseModel = new ResponseModel <Student>(); bool isSuccess = repositoryHelper.Student.CreateStudent(student); await repositoryHelper.SaveAsync(); if (isSuccess == true) { responseModel.StatusCode = HttpStatusCode.OK; responseModel.DataObject = student; responseModel.Message = ResponseMessage.OnSuccessSaveMessage; } else { responseModel.StatusCode = HttpStatusCode.BadRequest; responseModel.Message = ResponseMessage.OnErrorMessage; } return responseModel; })); }