public async Task <IHttpActionResult> Create(EventCreateModel createModel) { if (!await _eventsService.CanCreateAsync(createModel.GroupId)) { return(StatusCode(System.Net.HttpStatusCode.Forbidden)); } var @event = MapToEvent(createModel); var activityId = _eventsService.Create(@event); _reminderService.CreateIfNotExists(activityId, ReminderTypeEnum.OneDayBefore); @event = _eventsService.Get(activityId); if (createModel.GroupId.HasValue) { _groupActivityService.AddRelation(createModel.GroupId.Value, activityId); @event.GroupId = createModel.GroupId; } _activityTagsHelper.ReplaceTags(activityId, createModel.TagIdsData); ResolveMentions(createModel.Description, @event); var redirectUrl = _activityLinkService.GetLinks(activityId).Details; ReloadFeed(); return(Ok(redirectUrl)); }
protected override void OnNewsCreated(Guid activityId, NewsCreateModel model) { var news = _newsService.Get(activityId); var groupId = Request.QueryString.GetGroupIdOrNone(); groupId.IfSome(id => _groupActivityService.AddRelation(id, activityId)); if (model is NewsExtendedCreateModel extendedModel) { _activityTagsHelper.ReplaceTags(activityId, extendedModel.TagIdsData); } ResolveMentions(model.Description, news); }
protected override void OnNewsCreated(Guid activityId, NewsCreateModel model) { var groupId = Request.QueryString.GetGroupId(); if (groupId.HasValue) { _groupActivityService.AddRelation(groupId.Value, activityId); var news = _newsService.Get(activityId); news.GroupId = groupId; } if (model is NewsExtendedCreateModel extendedModel) { _activityTagsHelper.ReplaceTags(activityId, extendedModel.TagIdsData); } }
protected override void OnBulletinCreated(BulletinBase bulletin, BulletinCreateModel model) { base.OnBulletinCreated(bulletin, model); var groupId = Request.QueryString.GetGroupId(); if (groupId.HasValue) { _groupActivityService.AddRelation(groupId.Value, bulletin.Id); var extendedBulletin = _bulletinsService.Get(bulletin.Id); extendedBulletin.GroupId = groupId; } if (model is BulletinExtendedCreateModel extendedModel) { _activityTagsHelper.ReplaceTags(bulletin.Id, extendedModel.TagIdsData); } }
protected override void OnEventCreated(Guid activityId, EventCreateModel model) { _reminderService.CreateIfNotExists(activityId, ReminderTypeEnum.OneDayBefore); var groupId = Request.QueryString.GetGroupId(); if (groupId.HasValue) { _groupActivityService.AddRelation(groupId.Value, activityId); var @event = _eventsService.Get(activityId); @event.GroupId = groupId; } if (model is EventExtendedCreateModel extendedModel) { _activityTagsHelper.ReplaceTags(activityId, extendedModel.TagIdsData); } }
protected override void OnEventCreated(Guid activityId, EventCreateModel model) { _reminderService.CreateIfNotExists(activityId, ReminderTypeEnum.OneDayBefore); var @event = _eventsService.Get(activityId); var groupId = Request.QueryString.GetGroupIdOrNone(); groupId.IfSome(id => _groupActivityService.AddRelation(id, activityId)); @event.GroupId = groupId.ToNullable(); if (model is EventExtendedCreateModel extendedModel) { _activityTagsHelper.ReplaceTags(activityId, extendedModel.TagIdsData); } ResolveMentions(model.Description, @event); }
private void OnBulletinCreated(SocialBase social, SocialCreateModel model) { var groupId = HttpContext.Current.Request.QueryString.GetGroupIdOrNone(); if (groupId.HasValue) { _groupActivityService.AddRelation(groupId.Value, social.Id); } var extendedBulletin = _socialService.Get(social.Id); extendedBulletin.GroupId = groupId; _activityTagsHelper.ReplaceTags(social.Id, model.TagIdsData); if (model.Description.HasValue()) { ResolveMentions(model.Description, social); } }
protected override void OnBulletinCreated(BulletinBase bulletin, BulletinCreateModel model) { base.OnBulletinCreated(bulletin, model); var groupId = Request.QueryString.GetGroupIdOrNone(); groupId.IfSome(id => _groupActivityService.AddRelation(id, bulletin.Id)); var extendedBulletin = _bulletinsService.Get(bulletin.Id); extendedBulletin.GroupId = groupId.ToNullable(); if (model is BulletinExtendedCreateModel extendedModel) { _activityTagsHelper.ReplaceTags(bulletin.Id, extendedModel.TagIdsData); } if (string.IsNullOrEmpty(model.Description)) { return; } ResolveMentions(model.Description, bulletin); }