예제 #1
0
        public IDomainModel GetScore(Guid scoreId)
        {
            var scoreModel = new ScoreDomainModel();

            try
            {
                var scoreEntity = Interactor.GetScore(scoreId);

                scoreModel = new ScoreDomainModel(scoreEntity);
            }
            catch (GradeTrackerException e)
            {
                var errorModel = new ErrorDomainModel(e, false);

                return(errorModel);
            }

            return(scoreModel);
        }
예제 #2
0
        public IDomainModel CreateNewScore(CreateScoreDomainModel createModel)
        {
            var scoreModel     = new ScoreDomainModel();
            var newScoreEntity = ConvertModelToEntity(createModel);

            try
            {
                CalculateGrade(newScoreEntity);

                var scoreId = Interactor.CreateScore(newScoreEntity);

                scoreModel = (ScoreDomainModel)GetScore(scoreId);
            }
            catch (ObjectAlreadyExistsException oae)
            {
                var errorModel = new ErrorDomainModel(oae, true);

                return(errorModel);
            }

            return(scoreModel);
        }
예제 #3
0
 public GradeTrackerErrorViewModel(ErrorDomainModel domainModel)
 {
     Name      = domainModel.Name;
     Retry     = domainModel.Retry;
     Exception = domainModel.Exception;
 }