public ITeamDisbandedInIssueModel Update(ITeamDisbandedInIssueModel model) { // Validate model BusinessWorkflowBase.ValidateRequiredNullableID(model.Id); //BusinessWorkflowBase.ValidateRequiredString(model.Name, nameof(model.Name)); // Find existing entity // ReSharper disable once PossibleInvalidOperationException var existingEntity = TeamDisbandedInIssuesRepository.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 (TeamDisbandedInIssueMapper.AreEqual(model, existingEntity)) { return(TeamDisbandedInIssueMapper.MapToModel(existingEntity)); } // Map model to an existing entity TeamDisbandedInIssueMapper.MapToEntity(model, ref existingEntity); existingEntity.UpdatedDate = BusinessWorkflowBase.GenDateTime; // Update it TeamDisbandedInIssuesRepository.Update(TeamDisbandedInIssueMapper.MapToEntity(model)); // Try to Save Changes TeamDisbandedInIssuesRepository.SaveChanges(); // Return the new value return(Get(existingEntity.Id)); }
public void Verify_MapToModel_AssignsTeamDisbandedInIssueProperties() { // Arrange var mapper = new TeamDisbandedInIssueMapper(); var entity = TeamDisbandedInIssuesMockingSetup.DoMockingSetupForTeamDisbandedInIssue(); // 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 ITeamDisbandedInIssueModel Get(string key) { BusinessWorkflowBase.ValidateRequiredKey(key); return(TeamDisbandedInIssueMapper.MapToModel(TeamDisbandedInIssuesRepository.Get(key))); }
public ITeamDisbandedInIssueModel Get(int id) { BusinessWorkflowBase.ValidateRequiredID(id); return(TeamDisbandedInIssueMapper.MapToModel(TeamDisbandedInIssuesRepository.Get(id))); }