/// <summary> /// 获取指定分组的GroupID和GroupName /// </summary> /// <returns></returns> public static List <groupMembers> GetGroupInfo(int ID) { List <groupMembers> groupMembersList = new List <groupMembers>(); List <MySqlParameter> parameter = new List <MySqlParameter>(); StringBuilder sql = new StringBuilder("select ID,GroupName from grouptable where State=0 and ID=@id; "); parameter.Add(new MySqlParameter { ParameterName = "@id", MySqlDbType = MySqlDbType.Int32, Value = ID }); MySqlDataReader dr = MySQLHelper.ExecuteReader(CommandType.Text, sql.ToString(), parameter.ToArray()); while (dr.Read()) { groupMembers newgroupMembers = new groupMembers(); newgroupMembers.GroupID = Convert.ToInt32(dr["ID"]); newgroupMembers.GroupName = Convert.ToString(dr["GroupName"]); groupMembersList.Add(newgroupMembers); } dr.Close(); return(groupMembersList); }
public ActionResult DeleteConfirmed(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } groupMembers groupMembers = db.groupMembers.Find(id); db.groupMembers.Remove(groupMembers); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Details(int?id) { if (id == null) { return(RedirectToAction("Index", "Home")); } groupMembers groupMembers = db.groupMembers.Find(id); if (groupMembers == null) { return(HttpNotFound()); } return(View(groupMembers)); }
public ActionResult Edit([Bind(Include = "id,teamId,userId")] groupMembers groupMembers) { if (groupMembers == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } if (ModelState.IsValid) { db.Entry(groupMembers).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.teamId = new SelectList(db.teams1, "id", "name", groupMembers.teamId); return(View(groupMembers)); }
public ActionResult Edit(int?id) { if (id == null) { return(RedirectToAction("Index", "Home")); } groupMembers groupMembers = db.groupMembers.Find(id); if (groupMembers == null) { return(HttpNotFound()); } ViewBag.teamId = new SelectList(db.teams1, "id", "name", groupMembers.teamId); return(View(groupMembers)); }