コード例 #1
0
        public static coreModels.NotificationTemplate ToCoreModel(this webModels.NotificationTemplate notificationTemplate)
        {
            coreModels.NotificationTemplate retVal = new coreModels.NotificationTemplate();

            retVal.InjectFrom(notificationTemplate);

            return(retVal);
        }
コード例 #2
0
		public static coreModels.NotificationTemplate ToCoreModel(this webModels.NotificationTemplate notificationTemplate)
		{
			coreModels.NotificationTemplate retVal = new coreModels.NotificationTemplate();

			retVal.InjectFrom(notificationTemplate);

			return retVal;
		}
コード例 #3
0
		public NotificationTemplate Create(NotificationTemplate notificationTemplate)
		{
			using (var repository = _repositoryFactory())
			{
				var origEntity = repository.GetNotificationTemplateByNotification(notificationTemplate.NotificationTypeId, notificationTemplate.ObjectId, notificationTemplate.ObjectTypeId, notificationTemplate.Language);
				if (origEntity == null)
				{
					origEntity = notificationTemplate.ToDataModel();
					repository.Add(origEntity);
					CommitChanges(repository);
				}

				var retVal = GetById(origEntity.Id);

				return retVal;
			}
		}
コード例 #4
0
		public void Update(NotificationTemplate[] notificationTemplates)
		{
			using (var repository = _repositoryFactory())
			using (var changeTracker = base.GetChangeTracker(repository))
			{
				foreach (var notificationTemplate in notificationTemplates)
				{
					var sourceEntity = notificationTemplate.ToDataModel();
					var targetEntity = repository.GetNotificationTemplateByNotification(notificationTemplate.NotificationTypeId, notificationTemplate.ObjectId, notificationTemplate.ObjectTypeId, notificationTemplate.Language);
					if (targetEntity == null)
					{
						repository.Add(sourceEntity);
					}
					else
					{
						changeTracker.Attach(targetEntity);
						sourceEntity.Patch(targetEntity);
					}
				}
				CommitChanges(repository);
			}
		}