public ITeamIssueModel Update(ITeamIssueModel model)
        {
            // Validate model
            BusinessWorkflowBase.ValidateRequiredNullableID(model.Id);
            //BusinessWorkflowBase.ValidateRequiredString(model.Name, nameof(model.Name));
            // Find existing entity
            // ReSharper disable once PossibleInvalidOperationException
            var existingEntity = TeamIssuesRepository.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 (TeamIssueMapper.AreEqual(model, existingEntity))
            {
                return(TeamIssueMapper.MapToModel(existingEntity));
            }
            // Map model to an existing entity
            TeamIssueMapper.MapToEntity(model, ref existingEntity);
            existingEntity.UpdatedDate = BusinessWorkflowBase.GenDateTime;
            // Update it
            TeamIssuesRepository.Update(TeamIssueMapper.MapToEntity(model));
            // Try to Save Changes
            TeamIssuesRepository.SaveChanges();
            // Return the new value
            return(Get(existingEntity.Id));
        }
        public void Verify_MapToModel_AssignsTeamIssueProperties()
        {
            // Arrange
            var mapper = new TeamIssueMapper();
            var entity = TeamIssuesMockingSetup.DoMockingSetupForTeamIssue();
            // Act
            var model = mapper.MapToModel(entity.Object);

            // Assert
            // <None>
            // Related Objects
            Assert.Equal(entity.Object.TeamId, model.TeamId);
            Assert.Equal(entity.Object.IssueId, model.IssueId);
            // Associated Objects
            // <None>
        }
 public ITeamIssueModel Get(string key)
 {
     BusinessWorkflowBase.ValidateRequiredKey(key);
     return(TeamIssueMapper.MapToModel(TeamIssuesRepository.Get(key)));
 }
 public ITeamIssueModel Get(int id)
 {
     BusinessWorkflowBase.ValidateRequiredID(id);
     return(TeamIssueMapper.MapToModel(TeamIssuesRepository.Get(id)));
 }
 public void Verify_MapToModel_AssignsTeamIssueProperties()
 {
     // Arrange
     var mapper = new TeamIssueMapper();
     var entity = TeamIssuesMockingSetup.DoMockingSetupForTeamIssue();
     // Act
     var model = mapper.MapToModel(entity.Object);
     // Assert
     // <None>
     // Related Objects
     Assert.Equal(entity.Object.TeamId, model.TeamId);
     Assert.Equal(entity.Object.IssueId, model.IssueId);
     // Associated Objects
     // <None>
 }