public ActionResult <Group> AddGroup(Group body) { context.Add(new Group { Name = body.Name, SettlementId = body.SettlementId }); context.SaveChanges(); return(Ok()); }
public ActionResult Register(User user) { context.Add(new User { Id = user.Id, Login = user.Login, Name = user.Name, Password = user.Password, Email = user.Email }); context.SaveChanges(); return(Ok(user)); }
public ActionResult <Friend> AddFriend(Friend body) { var entity = context.Users.Where(x => x.Login == body.Name || x.Email == body.Name).FirstOrDefault(); context.Add(new Friend { UserId = body.UserId, Name = body.Name, FriendId = entity.Id }); context.SaveChanges(); return(Ok()); }
public ActionResult <SettlementUser> AddUserToSettlement(SettlementUser body) { var user = context.Users.Where(a => a.Login == body.UserId).FirstOrDefault(); var id = GetSettlementUserId(); var settlementUser = context.SettlementUsers; context.Add(new SettlementUser { SettlementId = body.SettlementId, UserId = user.Id, DisplayName = user.Name, RoleId = SettlementUser.Role.Watcher }); context.SaveChanges(); return(Ok(settlementUser)); }