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[]"]; Lipstick.dbml.Boards board = new Lipstick.dbml.Boards() { Name = name, CatID = cat, UserID = Common.UserID }; this.GetLipstickContext2.Boards.InsertOnSubmit(board); this.GetLipstickContext2.SubmitChanges(); if (!string.IsNullOrEmpty(contributors)) { string[] acontributors = contributors.Split(','); foreach (string contributor in acontributors) { this.GetLipstickContext2.BoardContributor.InsertOnSubmit(new Lipstick.dbml.BoardContributor() { BoardID = board.ID, ContributorID = GetLipstickContext3.AppUsers.First(o => o.Email == contributor).ID }); } this.GetLipstickContext2.SubmitChanges(); } context.Response.Write(board.ID); }
private void CreateBoard(HttpContext context) { Lipstick.dbml.Boards boards = new Lipstick.dbml.Boards(); boards.Name = context.Request.Params["name"]; this.GetLipstickContext2.Boards.InsertOnSubmit(boards); this.GetLipstickContext2.SubmitChanges(); }
private void SaveCreatedBoard(HttpContext context) { string name = context.Request.Params["name"]; Lipstick.dbml.Boards b = this.GetLipstickContext2.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); } }