public ActionResult Create([Bind(Include = "ID,Name,City")] Team team)
        {
            if (ModelState.IsValid)
            {
                db.Teams.Add(team);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(team));
        }
Beispiel #2
0
        public ActionResult Create([Bind(Include = "ID,LastName,FirstName,Age,PlayerNumber,TeamID,Position,Hits")] Player player)
        {
            if (ModelState.IsValid)
            {
                db.Players.Add(player);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.TeamID = new SelectList(db.Teams, "ID", "Name", player.TeamID);
            return(View(player));
        }
Beispiel #3
0
        public static void SeedClubs(RosterContext context)
        {
            Club lsc = new Club
            {
                Name         = "Langstone Sailing Club",
                ContactEmail = "*****@*****.**",
                PhoneNumber  = "07710471444"
            };
            Address lscAddress = new Address
            {
                Club        = lsc,
                HouseNumber = "LSC",
                Street      = "Langstone Rd",
                TownCity    = "Havant",
                Postcode    = "PO9 1RD"
            };

            lsc.Address.ToList().Add(lscAddress);
            if (!context.Clubs.Any(c => c.Name == lsc.Name))
            {
                context.Addresses.Add(lscAddress);
                context.Clubs.Add(lsc);
                context.SaveChanges();
            }
        }
        /// <summary>
        /// Add a new teammate to the team
        /// </summary>
        /// <param name="teammate"></param>
        /// <returns></returns>
        public virtual Teammate CreateTeammate(Teammate teammate)
        {
            Guard.NotNull(teammate, "Teammate");

            var team = context.Set <Teammate>();

            team.Add(teammate);
            context.SaveChanges();

            return(teammate);
        }
Beispiel #5
0
        public static void SeedDuties(RosterContext context)
        {
            var SafteyBoatDriver = new DutyType
            {
                Name         = "Safety Boat Driver",
                ClubId       = 1,
                Description  = "Driving a safety boat for an event.",
                Instructions = "Provide adiquite safety coverage for the event."
                               // Sb driver ,SB assistant, Race officer ,RO assistant
            };
            var SafteyBoatAssistant = new DutyType
            {
                Name         = "Safety Boat Assistant",
                ClubId       = 1,
                Description  = "Assisting the safety boat driver.",
                Instructions = "Help driver provide adiquite safety coverage for the event."
            };
            var RaceOfficer = new DutyType
            {
                Name         = "Race Officer",
                ClubId       = 1,
                Description  = "Help running a race by conducting start sequence and finish times.",
                Instructions = "Help organise launching of participants and making apropriate choices for shortened course etc based on circumstances. "
            };
            var RaceOfficerassistant = new DutyType
            {
                Name         = "Race Officer Assistant",
                ClubId       = 1,
                Description  = "Assisting thhe Race officer in running a race.",
                Instructions = "Assist the race officer with their duties to the best of your ability."
            };
            var d1 = new Duty
            {
                Name        = "test1",
                ClubId      = 1,
                Description = "test SB driver",
                FromDate    = DateTime.Now.AddDays(3),
                ToDate      = DateTime.Now.AddDays(3.5),
                Starttime   = "9:00AM",
                Endtime     = "4:00PM"
            };
            var d2 = new Duty
            {
                Name        = "test2",
                ClubId      = 1,
                Description = "test SB Assistant",
                FromDate    = DateTime.Now.AddDays(3),
                ToDate      = DateTime.Now.AddDays(3.5),
                Starttime   = "9:00AM",
                Endtime     = "4:00PM"
            };
            var d3 = new Duty
            {
                Name        = "test3",
                ClubId      = 1,
                Description = "test Race Officer",
                FromDate    = DateTime.Now.AddDays(5),
                ToDate      = DateTime.Now.AddDays(5.5),
                Starttime   = "9:00AM",
                Endtime     = "4:00PM"
            };
            var d4 = new Duty
            {
                Name        = "test4",
                ClubId      = 1,
                Description = "test RO Assistant",
                FromDate    = DateTime.Now.AddDays(5),
                ToDate      = DateTime.Now.AddDays(5.5),
                Starttime   = "9:00AM",
                Endtime     = "4:00PM"
            };

            context.DutyTypes.Add(SafteyBoatDriver);
            context.DutyTypes.Add(SafteyBoatAssistant);
            context.DutyTypes.Add(RaceOfficer);
            context.DutyTypes.Add(RaceOfficerassistant);

            context.Duties.Add(d1);
            context.Duties.Add(d2);
            context.Duties.Add(d3);
            context.Duties.Add(d4);

            context.SaveChanges();
        }