Exemplo n.º 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();
            }
        }
Exemplo n.º 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;
        }
Exemplo n.º 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);
        }
Exemplo n.º 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();
            }
        }