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

            // Assert
            // <None>
            // Related Objects
            Assert.Equal(entity.Object.EpisodeId, model.EpisodeId);
            Assert.Equal(entity.Object.ObjectId, model.ObjectId);
            // Associated Objects
            // <None>
        }
 public IEpisodeObjectFirstAppearanceModel Get(string key)
 {
     BusinessWorkflowBase.ValidateRequiredKey(key);
     return(EpisodeObjectFirstAppearanceMapper.MapToModel(EpisodeObjectFirstAppearancesRepository.Get(key)));
 }
 public IEpisodeObjectFirstAppearanceModel Get(int id)
 {
     BusinessWorkflowBase.ValidateRequiredID(id);
     return(EpisodeObjectFirstAppearanceMapper.MapToModel(EpisodeObjectFirstAppearancesRepository.Get(id)));
 }
 public void Verify_MapToModel_AssignsEpisodeObjectFirstAppearanceProperties()
 {
     // Arrange
     var mapper = new EpisodeObjectFirstAppearanceMapper();
     var entity = EpisodeObjectFirstAppearancesMockingSetup.DoMockingSetupForEpisodeObjectFirstAppearance();
     // Act
     var model = mapper.MapToModel(entity.Object);
     // Assert
     // <None>
     // Related Objects
     Assert.Equal(entity.Object.EpisodeId, model.EpisodeId);
     Assert.Equal(entity.Object.ObjectId, model.ObjectId);
     // Associated Objects
     // <None>
 }