public void DeleteRequest(int userId, int groupId) { GroupEnteringRequest request = dbContext.GroupEnteringRequests .Where(r => r.SenderId == userId && r.GroupId == groupId).First(); dbContext.GroupEnteringRequests.Remove(request); dbContext.SaveChanges(); }
public void AcceptRequest(int userId, int groupId) { GroupEnteringRequest request = dbContext.GroupEnteringRequests .Where(r => r.SenderId == userId && r.GroupId == groupId).First(); request.AnswerDate = DateTime.Now; dbContext.SaveChanges(); }
public void AddRequest(int userId, int groupId) { GroupEnteringRequest request = new GroupEnteringRequest() { GroupId = groupId, SenderId = userId, SendingDate = DateTime.Now, AnswerDate = DateTime.MinValue }; dbContext.GroupEnteringRequests.Add(request); dbContext.SaveChanges(); }