public bool Create(Join join) { join.Status = 1; using (var db = new FirewoodContext()) { db.Joins.Add(join); return db.SaveChanges() == 1 ? true : false; } }
public bool Create(Join join) { return joinHandler.Create(join); }
public ActionResult Join(Guid id) { Guid uid; if (Session["User"] != null) uid = new Guid(Session["User"].ToString()); else return Redirect(SiteConfig.SiteUrl+"/User/PostLogin"); //显示活动详情 showAct(id); ViewData["TopActList"] = actService.GetTopActList(); ViewData["OrgList"] = orgService.ShowAllOrg(9, 1); if (joinService.IsExist(id, uid)) { ViewBag.Button = "您已参与"; return Redirect(SiteConfig.SiteUrl + "/Act/Index/ID/" + id); } else ViewBag.Button = "我想参加"; Join join = new Join(); join.ActID = id; join.UserID = uid; if (!joinService.Create(join)) return Content("<script>alert('系统异常');</script>"); return Redirect(SiteConfig.SiteUrl+"/Act/Index/ID/"+id); }