Example #1
0
        public int StartRace(int _raceID, DateTime _startedTime)
        {
            // disconnected existing entity
            var curRace = new CX418DataAccess.Race()
            {
                ID = _raceID, RaceStartedTime = _startedTime
            };

            //using (CX418DataAccess.cx418timingEntities context = new CX418DataAccess.cx418timingEntities())
            //{
            //    context.Entry(curRace).State = curRace.ID == 0 ? EntityState.Added : EntityState.Modified;

            //    context.SaveChanges();
            //}

            return(_raceID);
        }
Example #2
0
        public int AddRace(RaceInformation _raceInfo)
        {
            int rowChange = -1;
            int curIdRace = -1;

            using (CX418DataAccess.cx418timingEntities context = new CX418DataAccess.cx418timingEntities()) {
                CX418DataAccess.Race raceObj = new CX418DataAccess.Race();
                raceObj.RaceName         = _raceInfo.RaceName;
                raceObj.RaceStartingTime = _raceInfo.RaceStartingTime;
                raceObj.RaceStartedTime  = _raceInfo.RaceStartingTime;
                raceObj.Description      = _raceInfo.Description;
                raceObj.RaceLenght       = _raceInfo.RaceLenght;
                raceObj.EventId          = _raceInfo.EventId;

                context.Races.Add(raceObj);

                rowChange = context.SaveChanges();
                curIdRace = raceObj.ID;
            }



            return(curIdRace);
        }