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(); } }
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; }
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); }
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(); } }