示例#1
0
        //Delete
        public int DeleteStadium(int StadiumID)
        {
            Stadiums stadium = ctx.Stadiums.Where(u => u.StadiumId == StadiumID).FirstOrDefault();

            ctx.Stadiums.Remove(stadium);
            return(ctx.SaveChanges());
        }
示例#2
0
        //Update

        public Stadiums UpdateStadium(string s_name, int capacity, string address, int StadiumID)
        {
            Stadiums stadium = ctx.Stadiums.Single(u => u.StadiumId == StadiumID);

            stadium.SName    = s_name;
            stadium.Capacity = capacity;
            stadium.Address  = address;
            ctx.SaveChanges();
            return(ctx.Stadiums.Single(u => u.StadiumId == StadiumID));
        }