Exemple #1
0
        public async Task <Result> InsertInterest(CreateInterestDTO createInterestDTO)
        {
            if (createInterestDTO == null)
            {
                return(Result.Fail(Constants.InterestErrorMessages.Interest_Should_Not_Be_Empty));
            }
            var interestResult = Interest.Create(createInterestDTO.InterestName, createInterestDTO.InterestDescription);

            if (!interestResult.IsSuccessed)
            {
                return(Result.Fail(interestResult.GetErrorString()));
            }

            _interestRepository.Create(interestResult.Value);
            return(await _interestRepository.SaveChangesAsync(InterestErrorMessages.Error_Occured_While_Inserting_Interest));
        }