private void DeleteGreenhouseUser(ListViewItem item) { var g = GreenhouseUser.All().Where(gu => gu.GreenhouseID == _webContext.GreenhouseIdSession && gu.Username == ((Literal)item.FindControl("litUsername")).Text).SingleOrDefault(); g.Delete(); Bind(); }
public IQueryable <GreenhouseUser> LoadGreenhouseUsers(DataContext dc, int greenhouseUserID) { Usernames.Clear(); var r = GreenhouseUser.All(dc).ByGreenhouseID(greenhouseUserID); foreach (var user in r) { Usernames.Add(user.Username); } return(r); }
protected void butAddUsers_Click(object sender, EventArgs e) { var userid = new Guid(ddlUsers.SelectedValue); if (GreenhouseUser.All().Where(gu => gu.UserID == userid).SingleOrDefault() == null) { new GreenhouseUser { UserID = userid, GreenhouseID = _webContext.GreenhouseIdSession, }.Save(); } Bind(); }