public Res AddStudent(aspnet_Users student, Group group, ModelContainer data) { bool Success = true; IEnumerable<Group> groups = null; try { foreach (Group g in student.Groups) g.aspnet_Users.Remove(student); group.aspnet_Users.Add(student); data.SaveChanges(); } catch (Exception e) { Success = false; } return new Res(Success, groups); }
public Res CreateRequest(aspnet_Users user, Group group, ModelContainer data) { bool Success = true; IEnumerable<StudentRequest> requests = null; //try // { StudentRequest request = data.StudentRequests.Create(); request.StudentRequestId = Guid.NewGuid(); request.aspnet_Users = user; request.Message = "m"; request.Group = group; data.StudentRequests.Add(request); data.SaveChanges(); // } // catch (Exception e) // { //Success = false; // } return new Res(Success, requests); }