public override void Create(Pharmacy pharmacy) { base.Create(pharmacy); //automatically insert the default message suite for the new pharmacy using (var service = new MessageTemplateService()) { List <MessageTemplate> templates = new List <MessageTemplate>(); foreach (var entry in defaultMessageTemplates) { templates.Add( new MessageTemplate() { Pharmacy = pharmacy, Type = entry.Key.Type, Media = entry.Key.Media, Content = entry.Value } ); } service.Create(templates); } //automatically insert the response options linked to the defautl message suite using (var service = new MessageResponseOptionService()) { foreach (var opt in defaultMessageResponseOptions) { service.Create(opt); } } }
private static List <MessageTemplate> GetTemplatesForPharmacy(int pId) { List <MessageTemplate> templates; using (var pharmService = new PharmacyService()) using (var service = new MessageTemplateService()) { templates = service.GetWhere(PharmacyService.CodeCol == pId); } return(templates); }