Esempio n. 1
0
        //Education
        public EducationResponse ExecuteGetEducations(RequestBase request)
        {
            var response = new EducationResponse();

            Type type = request.GetType();

            if (type.FullName == "BOA.Types.Banking.EducationRequest")
            {
                var pr = new BOA.Process.Banking.Education();

                if (request.MethodName == "GetEducations")
                {
                    response = pr.GetEducations((EducationRequest)request);
                }
            }
            return(response);
        }
Esempio n. 2
0
        public async Task <EducationResponse> DeleteAsync(int id)
        {
            try
            {
                var exist = await _educationRepository.FindByIdAsync(id);

                EducationResponse response = exist == null ? new EducationResponse($"Education {id} not found") : new EducationResponse(exist);

                _educationRepository.Remove(exist);
                await _unitOfWork.CompleteAsync();

                return(response);
            }
            catch (Exception e)
            {
                return(new EducationResponse($"An error occurred when deleting the education: { e.Message }"));
            }
        }
Esempio n. 3
0
        public async Task <EducationResponse> UpdateAsync(int id, Education education)
        {
            try
            {
                var exist = await _educationRepository.FindByIdAsync(id);

                EducationResponse response = exist == null ? new EducationResponse($"Education {id} not found") : new EducationResponse(exist);

                exist.Description = education.Description != "" ? education.Description : exist.Description;

                exist.Level = education.Level != "" ? education.Level : exist.Level;

                _educationRepository.Update(exist);
                await _unitOfWork.CompleteAsync();

                return(response);
            }
            catch (Exception e)
            {
                return(new EducationResponse($"An error occurred when updating the education: { e.Message }"));
            }
        }