public WebBuidTogether GetTogetherbyID(int id) { using (AIYunNetContext context = new AIYunNetContext()) { WebBuidTogether old = context.WebBuidTogether.Find(id); return(old); } }
public int AddBuidTogether(WebBuidTogether together) { using (AIYunNetContext context = new AIYunNetContext()) { context.WebBuidTogether.Add(together); context.SaveChanges(); return(1); } }
//确认合作 public int IsAccept(int id, int accept) { using (AIYunNetContext context = new AIYunNetContext()) { WebBuidTogether old = context.WebBuidTogether.Find(id); old.IsAccept = accept; context.SaveChanges(); return(1); } }
public JsonResult SendWorkTogether(WebBuidTogether tog) { int ret = 0; int ishave = TogSer.IsHaveTogther(tog.buidingID, tog.StageID); if (ishave == 0) { ret = TogSer.AddBuidTogether(tog); } return(Json(new { RetCode = ret })); }
//是否已经选择了伙伴 1有 0没有 public int IsHaveTogther(int buidingID, int StageID) { WebBuidTogether tog = new WebBuidTogether(); using (AIYunNetContext context = new AIYunNetContext()) { tog = context.WebBuidTogether.FirstOrDefault(c => c.buidingID == buidingID && c.StageID == StageID && c.IsAccept == 0); if (tog != null) { return(1); } else { return(0); } } }