private void SaveBoard(HttpContext context) { int cat = int.Parse(context.Request.Params["cat"]); string name = context.Request.Params["name"]; string contributors = context.Request.Params["contributors[]"]; EyeShadow.dbml.Boards board = new EyeShadow.dbml.Boards() { Name = name, CatID = cat, UserID = Common.UserID }; this.GetEyeShadowContext2.Boards.InsertOnSubmit(board); this.GetEyeShadowContext2.SubmitChanges(); if (!string.IsNullOrEmpty(contributors)) { string[] acontributors = contributors.Split(','); foreach (string contributor in acontributors) { this.GetEyeShadowContext2.BoardContributor.InsertOnSubmit(new EyeShadow.dbml.BoardContributor() { BoardID = board.ID, ContributorID = GetEyeShadowContext3.AppUsers.First(o => o.Email == contributor).ID }); } this.GetEyeShadowContext2.SubmitChanges(); } context.Response.Write(board.ID); }
private void CreateBoard(HttpContext context) { EyeShadow.dbml.Boards boards = new EyeShadow.dbml.Boards(); boards.Name = context.Request.Params["name"]; this.GetEyeShadowContext2.Boards.InsertOnSubmit(boards); this.GetEyeShadowContext2.SubmitChanges(); }
private void SaveCreatedBoard(HttpContext context) { string name = context.Request.Params["name"]; EyeShadow.dbml.Boards b = this.GetEyeShadowContext2.Boards.FirstOrDefault(o => o.Name == name && o.UserID == Common.UserID); if (b != null) { context.Response.Write("You already have a board with that name. Please use a different board name"); } else { SaveBoard(context); } }