public async Task <ActionResult> PostInGroup(GroupProfileModel model) { try { var authUser = await BasicUserFacade.GetUserByNickNameAsync(User.Identity.Name); var post = new GroupProfilePostDto() { PostedAt = DateTime.Now.ToUniversalTime(), StayAnonymous = model.PostStayAnonymous, GroupId = model.GroupProfile.Id, Text = model.NewPostText }; if (!post.StayAnonymous) { post.UserId = authUser.Id; } await GroupProfileFacade.PostInGroup(post); return(RedirectToAction("Index", new { groupId = model.GroupProfile.Id })); } catch { return(RedirectToAction("Index", new { groupId = model.GroupProfile.Id })); } }
public async Task <int> PostInGroup(GroupProfilePostDto post) { using (var uow = UnitOfWorkProvider.Create()) { var postId = _postService.Create(post); await uow.Commit(); return(postId); } }
public async Task CreatePost(GroupProfilePostDto post) { await GroupProfileFacade.PostInGroup(post); }