public IHttpActionResult UpdateCancellation(string username, string bit) { /*if (!ModelState.IsValid) * { * return BadRequest(ModelState); * }*/ try { tblBooking newbooking = new tblBooking(); newbooking = db.tblBookings.Find(username); if (newbooking != null) { newbooking.CancellationBit = bit; db.SaveChanges(); } else { return(NotFound()); } } catch (Exception) { throw; } return(Ok()); }
public IHttpActionResult UpdateBus(tblBu buss) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } try { tblBu updBus = new tblBu(); updBus = db.tblBus.Find("MH 04 JK 1700"); if (updBus != null) { updBus.NoOfSeats = buss.NoOfSeats; updBus.Source_ = buss.Source_; updBus.Destination = buss.Destination; updBus.ViaStop = buss.ViaStop; updBus.StartTime = buss.StartTime; updBus.EndTime = buss.EndTime; updBus.PerSeatCost = buss.PerSeatCost; updBus.BusType = buss.BusType; updBus.BusName = buss.BusName; db.SaveChanges(); } else { return(NotFound()); } } catch (Exception) { throw; } return(Ok(buss)); }
public void updateseats(string BusNo, int length) { dbNewBusEntities7 db = new dbNewBusEntities7(); tblBu f = (from p in db.tblBus where p.BusNo == BusNo select p).SingleOrDefault(); f.Availableseats = f.Availableseats - length; db.SaveChanges(); }
public IHttpActionResult RefundWallet(string username, float refunddetails) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } try { tblCustomer newcustomer = new tblCustomer(); newcustomer = db.tblCustomers.Find(username); if (newcustomer != null) { newcustomer.WalletDetails += refunddetails; db.SaveChanges(); } else { return(NotFound()); } } catch (Exception) { throw; } return(Ok()); }
public dynamic UpdatePassword(string EmailId, string Password_) { List <tblCustomer> cus = db.tblCustomers.ToList(); foreach (var item in cus) { if (item.EmailId == EmailId) { item.Password_ = Password_; db.Entry(item).State = System.Data.Entity.EntityState.Modified; db.SaveChanges(); return(Request.CreateResponse(HttpStatusCode.OK, "Valid")); } } return(Request.CreateResponse(HttpStatusCode.NotFound, "NotFound")); }
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) { dbNewBusEntities7 db = new dbNewBusEntities7(); 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 { dbNewBusEntities7 db = new dbNewBusEntities7(); 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 CreateFbk(Feedback feedbk) { try { tblBooking tblBooking = new tblBooking(); tblFeedback fb = new tblFeedback(); fb.Question1 = feedbk.Question1; fb.Question2 = feedbk.Question2; fb.Question3 = feedbk.Question3; fb.Question4 = feedbk.Question4; fb.Question5 = feedbk.Question5; db.tblFeedbacks.Add(fb); db.SaveChanges(); return(new Response { Status = "Success", Message = "SuccessFully Saved." }); } catch (Exception) { throw; } }
public object createbus(AddBus b) { try { dbNewBusEntities7 db = new dbNewBusEntities7(); 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." }); }