Пример #1
0
        public IHttpActionResult InsertOEvent(OEvent oevent)
        {
            PenOCDataContext db = new PenOCDataContext();

            tblEvent eventRecord = new tblEvent
            {
            strName = oevent.name,
            strControllerReport = oevent.controllerReport,
            intVenue = oevent.venueId,
            strCourses = oevent.courses,
            dteDate = oevent.date,
            strDirections = oevent.directions,
            intPlanner = oevent.plannerId,
            intController = oevent.controllerId,
            strRegTime = oevent.registrationTime,
            strStarts = oevent.startTime,
            strClose = oevent.close,
            strSpecialNote = oevent.specialNote,
            decCoordinateLat = oevent.coordinateLatitude,
            decCoordinateLong = oevent.coordinateLongitude,
            strCost = oevent.cost,
            intMaxPoints = oevent.maxPoints,
            strPlannerReport = oevent.plannerReport,
            intOrganisingClub = oevent.organizingClubId
            };

            db.tblEvents.InsertOnSubmit(eventRecord);
            db.SubmitChanges();

            oevent.id = eventRecord.idEvent;

            return Ok(oevent);
        }
Пример #2
0
        public IHttpActionResult UpdateOEvent(OEvent oevent)
        {
            PenOCDataContext db = new PenOCDataContext();

            tblEvent eventRecord = db.tblEvents.Single(e => e.idEvent == oevent.id);

            eventRecord.strName = oevent.name;
            eventRecord.intVenue = oevent.venueId;
            eventRecord.strCourses = oevent.courses;
            eventRecord.dteDate = oevent.date;
            eventRecord.strDirections = oevent.directions;
            eventRecord.intPlanner = oevent.plannerId;
            eventRecord.intController = oevent.controllerId;
            eventRecord.strRegTime = oevent.registrationTime;
            eventRecord.strStarts = oevent.startTime;
            eventRecord.strClose = oevent.close;
            eventRecord.strSpecialNote = oevent.specialNote;
            eventRecord.decCoordinateLat = oevent.coordinateLatitude;
            eventRecord.decCoordinateLong = oevent.coordinateLongitude;
            eventRecord.strCost = oevent.cost;
            eventRecord.intMaxPoints = oevent.maxPoints;
            eventRecord.strPlannerReport = oevent.plannerReport;
            eventRecord.strControllerReport = oevent.controllerReport;
            eventRecord.intOrganisingClub = oevent.organizingClubId;

            db.SubmitChanges();

            return Ok(oevent);
        }