public void StoreInDB(string location, string filename, int project, int userId) { using (BackingShareContext db = new BackingShareContext()) { Audio dbAudio = new Audio() { name = filename, userId = userId }; db.Audio.Add(dbAudio); db.SaveChanges(); Audio audio = db.Audio.Where(r => r.name == filename).FirstOrDefault(); ProjectsXAudios dbProjectsXAudios = new ProjectsXAudios() { audioId = audio.Id, projectId = project }; db.ProjectsXAudios.Add(dbProjectsXAudios); db.SaveChanges(); } }
public void Create(ProjectsModel projectModel) { using (BackingShareContext db = new BackingShareContext()) { Projects dbProject = new Projects() { name = projectModel.name, isPublic = projectModel.isPublic, userId = projectModel.userId }; db.Projects.Add(dbProject); db.SaveChanges(); } }
public void CreateUser(User userInfo, string passwordHash) { using (BackingShareContext db = new BackingShareContext()) { Users dbUser = new Users() { Username = userInfo.Username, Email = userInfo.Email, PasswordHash = passwordHash, }; db.Users.Add(dbUser); db.SaveChanges(); } }