Exemplo n.º 1
0
        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[]"];

            Nails.edmx.Boards board = new Nails.edmx.Boards()
            {
                Name   = name,
                CatID  = cat,
                UserID = Common.UserID
            };
            this.GetNailsProdContext.Boards.AddObject(board);
            this.GetNailsProdContext.SaveChanges();
            if (!string.IsNullOrEmpty(contributors))
            {
                string[] acontributors = contributors.Split(',');
                foreach (string contributor in acontributors)
                {
                    this.GetNailsProdContext.BoardContributor.AddObject(new Nails.edmx.BoardContributor()
                    {
                        BoardID       = board.ID,
                        ContributorID = GetNailsProdContext3.AppUsers.First(o => o.Email == contributor).ID
                    });
                }
                this.GetNailsProdContext.SaveChanges();
            }
            context.Response.Write(board.ID);
        }
Exemplo n.º 2
0
 private void CreateBoard(HttpContext context)
 {
     Nails.edmx.Boards boards = new Nails.edmx.Boards();
     boards.Name = context.Request.Params["name"];
     this.GetNailsProdContext.AddToBoards(boards);
     this.GetNailsProdContext.SaveChanges();
 }
Exemplo n.º 3
0
        private void SaveCreatedBoard(HttpContext context)
        {
            string name = context.Request.Params["name"];

            Nails.edmx.Boards b = this.GetNailsProdContext.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);
            }
        }