public async Task Init(PlayerControlInitMesg mesg) { var result = RoomManager.GetRoom(mesg.RoomName, out _room); if (result) { await _room.AddAsync(Context); } }
/// <summary> /// 加入房间 /// </summary> /// <param name="room"></param> /// <param name="context"></param> /// <returns></returns> public static async Task JoinRoom(IGroup room, ServiceContext context) { try { await room.AddAsync(context); } catch (Exception e) { Console.WriteLine(e); } }
public async Task <IActionResult> Create(GroupViewModel view) { if (ModelState.IsValid) { var user = await _userHelper.GetUserByEmailAsync(User.Identity.Name); if (user == null) { return(NotFound()); } var group = await MakeGroup(view, user, true); await _groupRepository.AddAsync(@group); return(RedirectToAction(nameof(Index))); } return(View(view)); }
public async Task <IActionResult> Create(GroupViewModel vm) { if (ModelState.IsValid) { var user = await UserHelper.GetUserByEmailAsync(User.Identity.Name); if (user == null) { return(NotFound()); } var group = await MakeGroup(vm, user, true); await _groupRepository.AddAsync(group); return(RedirectToAction(nameof(SwitchToTabs), new { tabname = "GroupPosts", group.Id })); } return(View(vm)); }
public async Task <IActionResult> Create(GroupViewModel vm) { if (ModelState.IsValid) { var user = await UserHelper.GetUserByEmailAsync(User.Identity.Name); if (user == null) { return(NotFound()); } var group = await MakeGroup(vm, user, true); await _groupRepository.AddAsync(group); var gMember = new GroupMember { Name = "I am the Admin", Group = group, ApplicationDate = DateTime.UtcNow, User = user, Banned = false, State = true, Applied = true, MemberType = (MemberType)2, }; await _context.GroupMembers.AddAsync(gMember); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(SwitchToTabs), new { tabname = "GroupPosts", group.Id })); } return(View(vm)); }
public async ValueTask AddAsync(ServiceContext context) { await database.StringIncrementAsync(counterKey, 1).ConfigureAwait(false); await inmemoryGroup.AddAsync(context).ConfigureAwait(false); }