public async Task <IHttpActionResult> PostAuthority(Authority r) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.M_Authorities.Add(r); await db.SaveChangesAsync(); return(CreatedAtRoute("DefaultApi", new { id = r.AuthorityID }, r)); }
public async Task <IHttpActionResult> PostMember(Member r) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.M_Members.Add(r); await db.SaveChangesAsync(); return(CreatedAtRoute("DefaultApi", new { id = r.MemberID }, r)); }
public async Task SendNameByGroup(string Name, string teamName) { var team = _context.Teams.Where(x => x.name == teamName).FirstOrDefault(); if (team != null) { team.Users.Add(new User { name = Name }); } else { var newTeam = new Team { name = teamName }; newTeam.Users.Add(new User { name = Name }); _context.Teams.Add(newTeam); } await _context.SaveChangesAsync(); await Clients.Group(teamName).SendAsync("ReceiveMessageByGroup", Name, team.Id); }