Exemple #1
0
        public void Post([FromBody] TripTO tripTO)
        {
            using (var db = new Fish360Project.f360Entities())
            {
                Trips newTrip = new Trips();
                newTrip.name      = tripTO.name;
                newTrip.notes     = tripTO.notes;
                newTrip.startDate = DateTime.Parse(tripTO.startDate); //, "yyyy-MM-dd", CultureInfo.InvariantCulture);
                newTrip.endDate   = DateTime.Parse(tripTO.endDate);   //, "yyyy-MM-dd", CultureInfo.InvariantCulture);
                newTrip.userId    = tripTO.userId;

                db.Trips.Add(newTrip);
                db.SaveChanges();
            }
        }
Exemple #2
0
        public string CreateTrip(TripTO tripTO, string token)
        {
            using (var db = new Fish360Project.f360Entities())
            {
                UserTO userTO = FindUserForToken(token);

                Trips newTrip = new Trips();
                newTrip.name = tripTO.name;
                newTrip.startDate = DateTime.ParseExact(tripTO.startDate, "yyyy-MM-dd", CultureInfo.InvariantCulture);
                newTrip.endDate = DateTime.ParseExact(tripTO.endDate, "yyyy-MM-dd", CultureInfo.InvariantCulture);
                newTrip.userId = userTO.id;

                db.Trips.Add(newTrip);
                db.SaveChanges();
            }
            return null;
        }
Exemple #3
0
        public string CreateTrip(TripTO tripTO, string token)
        {
            using (var db = new Fish360Project.f360Entities())
            {
                UserTO userTO = FindUserForToken(token);

                Trips newTrip = new Trips();
                newTrip.name      = tripTO.name;
                newTrip.notes     = tripTO.notes;
                newTrip.startDate = DateTime.ParseExact(tripTO.startDate, "yyyy-MM-dd", CultureInfo.InvariantCulture);
                newTrip.endDate   = DateTime.ParseExact(tripTO.endDate, "yyyy-MM-dd", CultureInfo.InvariantCulture);
                newTrip.userId    = userTO.id;

                db.Trips.Add(newTrip);
                db.SaveChanges();
            }
            return(null);
        }
Exemple #4
0
        public void Post([FromBody]TripTO tripTO)
        {
            using (var db = new Fish360Project.f360Entities())
            {
                Trips newTrip = new Trips();
                newTrip.name = tripTO.name;
                newTrip.startDate = DateTime.ParseExact(tripTO.startDate, "yyyy-MM-dd", CultureInfo.InvariantCulture);
                newTrip.endDate = DateTime.ParseExact(tripTO.endDate, "yyyy-MM-dd", CultureInfo.InvariantCulture);
                newTrip.userId = tripTO.userId;

                db.Trips.Add(newTrip);
                db.SaveChanges();
            }
        }