public void Add(TripsInfoModel tripInfoViewModel) { var trip = new Trip { StartPoint = tripInfoViewModel.StartPoint, EndPoint = tripInfoViewModel.EndPoint, DepartureTime = tripInfoViewModel.DepartureTime, Seats = tripInfoViewModel.Seats, Description = tripInfoViewModel.Description, }; this.db.Trips.Add(trip); this.db.SaveChanges(); }
public HttpResponse Add(TripsInfoModel input) { if (!this.IsUserLoggedIn()) { return(this.Redirect("/Users/Login")); } if (input.Seats < 2 || input.Seats > 6) { return(this.View()); } if (input.Description.Length > 80) { return(this.View()); } this.itripService.Add(input); return(this.Redirect("/Trips/All")); }