Ejemplo n.º 1
0
        public IConceptAppearedInIssueModel Update(IConceptAppearedInIssueModel model)
        {
            // Validate model
            BusinessWorkflowBase.ValidateRequiredNullableID(model.Id);
            //BusinessWorkflowBase.ValidateRequiredString(model.Name, nameof(model.Name));
            // Find existing entity
            // ReSharper disable once PossibleInvalidOperationException
            var existingEntity = ConceptAppearedInIssuesRepository.Get(model.Id.Value);

            // Check if we would be applying identical information, if we are, just return the original
            // ReSharper disable once SuspiciousTypeConversion.Global
            if (ConceptAppearedInIssueMapper.AreEqual(model, existingEntity))
            {
                return(ConceptAppearedInIssueMapper.MapToModel(existingEntity));
            }
            // Map model to an existing entity
            ConceptAppearedInIssueMapper.MapToEntity(model, ref existingEntity);
            existingEntity.UpdatedDate = BusinessWorkflowBase.GenDateTime;
            // Update it
            ConceptAppearedInIssuesRepository.Update(ConceptAppearedInIssueMapper.MapToEntity(model));
            // Try to Save Changes
            ConceptAppearedInIssuesRepository.SaveChanges();
            // Return the new value
            return(Get(existingEntity.Id));
        }
        public void Verify_MapToModel_AssignsConceptAppearedInIssueProperties()
        {
            // Arrange
            var mapper = new ConceptAppearedInIssueMapper();
            var entity = ConceptAppearedInIssuesMockingSetup.DoMockingSetupForConceptAppearedInIssue();
            // Act
            var model = mapper.MapToModel(entity.Object);

            // Assert
            // <None>
            // Related Objects
            Assert.Equal(entity.Object.ConceptId, model.ConceptId);
            Assert.Equal(entity.Object.AppearedInIssueId, model.AppearedInIssueId);
            // Associated Objects
            // <None>
        }
Ejemplo n.º 3
0
 public IConceptAppearedInIssueModel Get(int id)
 {
     BusinessWorkflowBase.ValidateRequiredID(id);
     return(ConceptAppearedInIssueMapper.MapToModel(ConceptAppearedInIssuesRepository.Get(id)));
 }
Ejemplo n.º 4
0
 public IConceptAppearedInIssueModel Get(string key)
 {
     BusinessWorkflowBase.ValidateRequiredKey(key);
     return(ConceptAppearedInIssueMapper.MapToModel(ConceptAppearedInIssuesRepository.Get(key)));
 }
 public void Verify_MapToModel_AssignsConceptAppearedInIssueProperties()
 {
     // Arrange
     var mapper = new ConceptAppearedInIssueMapper();
     var entity = ConceptAppearedInIssuesMockingSetup.DoMockingSetupForConceptAppearedInIssue();
     // Act
     var model = mapper.MapToModel(entity.Object);
     // Assert
     // <None>
     // Related Objects
     Assert.Equal(entity.Object.ConceptId, model.ConceptId);
     Assert.Equal(entity.Object.AppearedInIssueId, model.AppearedInIssueId);
     // Associated Objects
     // <None>
 }