public async Task <IHttpActionResult> Post(PublishPlanTemplateDTO dto) { var fr8AccountId = User.Identity.GetUserId(); var planTemplateCM = await _planTemplate.CreateOrUpdate(fr8AccountId, dto); await _searchProvider.CreateOrUpdate(planTemplateCM); await _webservicesPageGenerator.Generate(planTemplateCM, fr8AccountId); await _planTemplateDetailsGenerator.Generate(dto); return(Ok()); }
public async Task Share(Guid planId, string userId) { try { var planDto = CrateTemplate(planId, userId); var dto = new PublishPlanTemplateDTO { Name = planDto.Name, Description = planDto.Description, ParentPlanId = planId, PlanContents = planDto }; var planTemplateCM = await _planTemplate.CreateOrUpdate(userId, dto); await _searchProvider.CreateOrUpdate(planTemplateCM); await _webservicesPageGenerator.Generate(planTemplateCM, userId); await _planTemplateDetailsGenerator.Generate(dto); // Notify user with directing him to PlanDirectory with related search query var url = CloudConfigurationManager.GetSetting("PlanDirectoryUrl") + "/plan_directory#?planSearch=" + HttpUtility.UrlEncode(dto.Name); _pusherNotifier.NotifyUser(new NotificationMessageDTO { NotificationType = NotificationType.GenericSuccess, Subject = "Success", Message = $"Plan Shared. To view, click on " + url, Collapsed = false }, userId); } catch { _pusherNotifier.NotifyUser(new NotificationMessageDTO { NotificationType = NotificationType.GenericSuccess, Subject = "Success", Message = $"Plan sharing failed", Collapsed = false }, userId); } }