public static coreModels.NotificationTemplate ToCoreModel(this webModels.NotificationTemplate notificationTemplate) { coreModels.NotificationTemplate retVal = new coreModels.NotificationTemplate(); retVal.InjectFrom(notificationTemplate); return(retVal); }
public static coreModels.NotificationTemplate ToCoreModel(this webModels.NotificationTemplate notificationTemplate) { coreModels.NotificationTemplate retVal = new coreModels.NotificationTemplate(); retVal.InjectFrom(notificationTemplate); return retVal; }
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; } }
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); } }