// crud only public void Create(string projectTitle, string projectDescription, string mentorFirstName, string mentorLastName) { var project = new Project() { Title = projectTitle, Description = projectDescription, CreatedAt = DateTime.Now, UpdatedAt = DateTime.Now, UserId = Global.userId, Rating = 5.0F, }; context.Projects.Add(project); context.SaveChanges(); }
// crud only public User Create(string firstName, string lastName, string email, string password) { // todo: validation! var id = Guid.NewGuid(); var user = new User() { Id = id, FirstName = firstName, LastName = lastName, Email = email, Password = password, }; Global.user = user; Global.userId = id; // save to db context.Users.Add(user); context.SaveChanges(); return(user); }