/// <summary> /// Returns the userProject object fram database. If record does not exists, it will create a new record and return that. /// </summary> /// <param name="projectName"></param> /// <param name="userId"></param> /// <returns></returns> public UserProject GetUserProject(string projectName, int userId) { UserProject proj = _database.UserProjects.Where<UserProject>(p => p.Name == projectName && p.UserId == userId).FirstOrDefault(); if (proj == null) { UserProject np = new UserProject() { Name = projectName, UserId = userId }; _database.UserProjects.InsertOnSubmit(np); _database.SubmitChanges(); return np; } else { return proj; } }
private void detach_UserProjects(UserProject entity) { this.SendPropertyChanging(); entity.User = null; }
private void attach_UserProjects(UserProject entity) { this.SendPropertyChanging(); entity.User = this; }
partial void DeleteUserProject(UserProject instance);
partial void UpdateUserProject(UserProject instance);
partial void InsertUserProject(UserProject instance);