public void updateseats(string BusNo, int length) { dbNewBusEntities8 db = new dbNewBusEntities8(); tblBu f = (from p in db.tblBus where p.BusNo == BusNo select p).SingleOrDefault(); f.Availableseats = f.Availableseats - length; db.SaveChanges(); }
public IHttpActionResult uncreatebookings(string Source_B, string Destination_B, string StartDate, string StartTime, float TravelFare, string EmailId, string BusNo, string SelectedSeats, string TicketType, string paymentBy) { dbNewBusEntities8 db = new dbNewBusEntities8(); tblBooking customer = new tblBooking(); customer.Source_B = Source_B; customer.Destination_B = Destination_B; customer.StartDate = StartDate; customer.StartTime = StartTime; customer.TravelFare = TravelFare; customer.EmailId = EmailId; customer.BusNo = BusNo; customer.SelectedSeats = SelectedSeats; customer.paymentBy = paymentBy; // customer.WalletDetails = wallet; customer.TicketType = TicketType; customer.CancellationBit = "0"; db.tblBookings.Add(customer); db.SaveChanges(); return(Ok()); }
public object createcontact(Registration rvm) { try { dbNewBusEntities8 db = new dbNewBusEntities8(); tblCustomer customer = new tblCustomer(); if (customer.EmailId == null) { customer.username = rvm.username; customer.Fname = rvm.Fname; customer.Lname = rvm.Lname; customer.Password_ = rvm.Password_; customer.EmailId = rvm.EmailId; customer.ContactNo = rvm.ContactNo; customer.Address = rvm.Address; customer.DOB = rvm.DOB; customer.Gender = rvm.Gender; // customer.WalletDetails = wallet; db.tblCustomers.Add(customer); db.SaveChanges(); return(new Response { Status = "Success", Message = "SuccessFully Saved." }); } } catch (Exception) { throw; } return(new Response { Status = "Error", Message = "Invalid Data." }); }
public object createbus(AddBus b) { try { dbNewBusEntities8 db = new dbNewBusEntities8(); tblBu bu = new tblBu(); if (bu.BusNo == null) { bu.BusNo = b.BusNo; bu.NoOfSeats = b.NoOfSeats; bu.Source_ = b.Source_; bu.Destination = b.Destination; bu.ViaStop = b.ViaStop; bu.StartTime = b.StartTime; bu.EndTime = b.EndTime; bu.PerSeatCost = b.PerSeatCost; bu.BusType = b.BusType; bu.BusName = b.BusName; db.tblBus.Add(bu); db.SaveChanges(); return(new Response { Status = "Success", Message = "SuccessFully Saved." }); } } catch (Exception) { throw; } return(new Response { Status = "Error", Message = "Invalid Data." }); }