Пример #1
0
 private static ScoreEntity ConvertModelToEntity(CreateScoreDomainModel createModel)
 {
     return(new ScoreEntity
     {
         Name = createModel.Name,
         EvaluationId = createModel.EvaluationId,
         Date = createModel.Date,
         PointsPossible = createModel.PointsPossible,
         PointsEarned = createModel.PointsEarned
     });
 }
Пример #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);
        }