public ActionResult Edit(Event anEvent) { if (ModelState.IsValid) { db.Entry(anEvent).State = EntityState.Modified; db.SaveChanges(); // return RedirectToAction("Index"); } ViewBag.BookingID = new SelectList(db.Bookings, "BookingID", "BookingPRCReference", anEvent.BookingID); ViewBag.BookingExtraSelectionID = new SelectList(db.BookingExtraSelections, "BookingExtraSelectionID", "Test", anEvent.BookingExtraSelectionID); ViewBag.EventTypeID = new SelectList(db.EventTypes, "EventTypeID", "EventTypeName", anEvent.EventTypeID); return(View(anEvent)); }
public bool CancelBooking(long bookingID) { Booking booking = db.Bookings.Include(x => x.Customer).First(x => x.BookingID == bookingID); booking.Cancelled = true; if (ModelState.IsValid) { db.Entry(booking).State = EntityState.Modified; db.SaveChanges(); return(true); } return(false); }
public ActionResult Edit(Property property) { var oldProp = db.Properties.Where(x => x.PropertyID == property.PropertyID).FirstOrDefault(); property.WhenCreated = oldProp.WhenCreated; property.WhenUpdated = oldProp.WhenUpdated; if (ModelState.IsValid) { using (var _db = new PortugalVillasContext()) { _db.Properties.Attach(property); _db.Entry(property).State = EntityState.Modified; _db.SaveChanges(); ViewBag.PropertyOwnerRepresentativeID = new SelectList(db.PropertyOwnerRepresentatives, "PropertyOwnerRepresentativeID", "PropertyOwnerRepresentativeName", property.PropertyOwnerRepresentativeID); ViewBag.PropertyOwnerID = new SelectList(db.PropertyOwners, "PropertyOwnerID", "PropertyOwnerEmailAddress", property.PropertyOwnerID); ViewBag.PropertyTownID = new SelectList(db.PropertyTowns, "PropertyTownID", "TownName", property.PropertyTownID); ViewBag.PropertyTypeID = new SelectList(db.PropertyTypes, "PropertyTypeID", "PropertyTypeName", property.PropertyTypeID); ViewBag.PropertyVacationTypeID = new SelectList(db.PropertyVacationTypes, "PropertyVacationTypeID", "PropertyVacationTypeDescription", property.PropertyVacationTypeID); return(View("SinglePropertyIndex", property)); } } ViewBag.PropertyOwnerRepresentativeID = new SelectList(db.PropertyOwnerRepresentatives, "PropertyOwnerRepresentativeID", "PropertyOwnerRepresentativeName", property.PropertyOwnerRepresentativeID); ViewBag.PropertyOwnerID = new SelectList(db.PropertyOwners, "PropertyOwnerID", "PropertyOwnerEmailAddress", property.PropertyOwnerID); ViewBag.PropertyTownID = new SelectList(db.PropertyTowns, "PropertyTownID", "TownName", property.PropertyTownID); ViewBag.PropertyTypeID = new SelectList(db.PropertyTypes, "PropertyTypeID", "PropertyTypeName", property.PropertyTypeID); ViewBag.PropertyVacationTypeID = new SelectList(db.PropertyVacationTypes, "PropertyVacationTypeID", "PropertyVacationTypeDescription", property.PropertyVacationTypeID); return(View("SinglePropertyIndex", property)); }
public ActionResult Edit(Booking booking) { var oldbook = db.Bookings.Where(x => x.BookingID == booking.BookingID).FirstOrDefault(); booking.CreationDate = oldbook.CreationDate; booking.LastUpdated = oldbook.LastUpdated; if (ModelState.IsValid) { using (var _db = new PortugalVillasContext()) { _db.Bookings.Attach(booking); _db.Entry(booking).State = EntityState.Modified; _db.SaveChanges(); ViewBag.BookingParentContainerID = new SelectList(db.BookingParentContainers, "BookingParentContainerID", "OverallBookingReference", booking.BookingParentContainerID); ViewBag.CustomerID = new SelectList(db.Customers, "CustomerID", "Title", booking.CustomerID); ViewBag.PropertyID = new SelectList(db.Properties, "PropertyID", "LegacyReference", booking.PropertyID); return(View("SingleBookingIndex", db.Bookings.Include(x => x.Customer).FirstOrDefault(x => x.BookingID == booking.BookingID))); } } ViewBag.BookingParentContainerID = new SelectList(db.BookingParentContainers, "BookingParentContainerID", "OverallBookingReference", booking.BookingParentContainerID); ViewBag.CustomerID = new SelectList(db.Customers, "CustomerID", "Title", booking.CustomerID); ViewBag.PropertyID = new SelectList(db.Properties, "PropertyID", "LegacyReference", booking.PropertyID); return(View("SingleBookingIndex", db.Bookings.Include(x => x.Customer).FirstOrDefault(x => x.BookingID == booking.BookingID))); }
public ActionResult Edit(BookingExtraSelection bookingextraselection) { var oldBes = db.BookingExtraSelections.Where( x => x.BookingExtraSelectionID == bookingextraselection.BookingExtraSelectionID).FirstOrDefault(); bookingextraselection.WhenCreated = oldBes.WhenCreated; if (ModelState.IsValid) { using (var _db = new PortugalVillasContext()) { _db.BookingExtraSelections.Attach(bookingextraselection); _db.Entry(bookingextraselection).State = EntityState.Modified; _db.SaveChanges(); Session["recentBES"] = bookingextraselection.BookingExtraSelectionID; return(RedirectToAction("Edit", "BookingExtraSelection", new { BookingExtraSelectionId = bookingextraselection.BookingExtraSelectionID })); } } ViewBag.AirportPickupLocationID = new SelectList(db.AirportDestinations, "AirportPickupLocationID", "AirportPickupLocationName", bookingextraselection.AirportPickupLocationID); ViewBag.BookingExtraID = new SelectList(db.BookingExtras, "BookingExtraID", "LegacyReference", bookingextraselection.BookingExtraID); ViewBag.BookingParentContainerID = new SelectList(db.BookingParentContainers, "BookingParentContainerID", "OverallBookingReference", bookingextraselection.BookingParentContainerID); ViewBag.CustomerID = new SelectList(db.Customers, "CustomerID", "Title", bookingextraselection.CustomerID); return(View(bookingextraselection)); }
// PUT api/BookingAPI/5 public HttpResponseMessage PutBooking(long id, Booking booking) { if (!ModelState.IsValid) { return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, ModelState)); } if (id != booking.BookingID) { return(Request.CreateResponse(HttpStatusCode.BadRequest)); } db.Entry(booking).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException ex) { return(Request.CreateErrorResponse(HttpStatusCode.NotFound, ex)); } return(Request.CreateResponse(HttpStatusCode.OK)); }
public ActionResult Edit(PRCInformation prcinformation) { if (ModelState.IsValid) { db.Entry(prcinformation).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(prcinformation)); }
public ActionResult Edit(CustomerBankDetail customerbankdetail) { if (ModelState.IsValid) { db.Entry(customerbankdetail).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index", "CustomerBankDetail", new { customerId = customerbankdetail.CustomerID })); } return(View(customerbankdetail)); }
public ActionResult Edit(ThirdPartyService thirdpartyservice) { if (ModelState.IsValid) { db.Entry(thirdpartyservice).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(thirdpartyservice)); }
public ActionResult Edit(Comment comment) { if (ModelState.IsValid) { db.Entry(comment).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.PropertyID = new SelectList(db.Properties, "PropertyID", "LegacyReference", comment.PropertyID); return(View(comment)); }
public ActionResult Edit(CommentReply commentreply) { if (ModelState.IsValid) { db.Entry(commentreply).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.CommentID = new SelectList(db.Comments, "CommentID", "Username", commentreply.CommentID); return(View(commentreply)); }
public ActionResult Edit(EntityTypeDetailField entitytypedetailfield) { if (ModelState.IsValid) { db.Entry(entitytypedetailfield).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.EntityTypeID = new SelectList(db.EntityTypes, "EntityTypeID", "EntityTypeName", entitytypedetailfield.EntityTypeID); return(View(entitytypedetailfield)); }
public ActionResult Edit(EventType eventtype) { if (ModelState.IsValid) { db.Entry(eventtype).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.EventSchemeTypeID = new SelectList(db.EventSchemeTypes, "EventSchemeTypeID", "EventSchemeTypeName", eventtype.EventSchemeTypeID); ViewBag.EventSubTypeID = new SelectList(db.EventSubTypes, "EventSubTypeID", "EventSubTypeName", eventtype.EventSubTypeID); return(View(eventtype)); }
public ActionResult EditCustomer(Customer customer) { PortugalVillasContext db = new PortugalVillasContext(); if (ModelState.IsValid) { db.Entry(customer).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(customer)); }
public ActionResult Edit(PropertyOwnerAccount propertyowneraccount) { if (ModelState.IsValid) { db.Entry(propertyowneraccount).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.PropertyOwnerID = new SelectList(db.PropertyOwners, "PropertyOwnerID", "PropertyOwnerEmailAddress", propertyowneraccount.PropertyOwnerID); ViewBag.ThirdPartyServiceID = new SelectList(db.ThirdPartyServices, "ThirdPartyServiceID", "ThirdPartyServiceName", propertyowneraccount.ThirdPartyServiceID); return(View(propertyowneraccount)); }
public ActionResult Edit(PropertyEntity propertyentity) { if (ModelState.IsValid) { db.Entry(propertyentity).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.PropertyID = new SelectList(db.Properties, "PropertyID", "LegacyReference", propertyentity.PropertyID); ViewBag.PropertyEntityTypeID = new SelectList(db.PropertyEntityTypes, "PropertyEntityTypeID", "PropertyEntityTypeName", propertyentity.PropertyEntityTypeID); return(View(propertyentity)); }
public ActionResult Edit(AccountTransaction accounttransaction) { if (ModelState.IsValid) { db.Entry(accounttransaction).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.BookingID = new SelectList(db.Bookings, "BookingID", "BookingPRCReference", accounttransaction.BookingID); ViewBag.BookingExtraSelectionID = new SelectList(db.BookingExtraSelections, "BookingExtraSelectionID", "BookingExtraPRCReference", accounttransaction.BookingExtraSelectionID); return(View(accounttransaction)); }
public ActionResult Edit(PropertyPricingSeasonalInstance propertypricingseasonalinstance) { if (ModelState.IsValid) { db.Entry(propertypricingseasonalinstance).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index", propertypricingseasonalinstance.PropertyID)); } ViewBag.PropertyID = new SelectList(db.Properties, "PropertyID", "LegacyReference", propertypricingseasonalinstance.PropertyID); ViewBag.PropertyPricingSeasonID = new SelectList(db.PropertyPricingSeasons, "PropertyPricingSeasonID", "Season_Name", propertypricingseasonalinstance.PropertyPricingSeasonID); return(View(propertypricingseasonalinstance)); }
public ActionResult Edit(Document document) { if (ModelState.IsValid) { db.Entry(document).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.BookingExtraSelectionID = new SelectList(db.BookingExtraSelections, "BookingExtraSelectionID", "Test", document.BookingExtraSelectionID); ViewBag.CaseID = new SelectList(db.Cases, "CaseID", "CaseID", document.CaseID); ViewBag.EventID = new SelectList(db.Events, "EventID", "EventID", document.EventID); return(View(document)); }
public ActionResult Edit(PropertyRegion propertyregion) { if (ModelState.IsValid) { using (var _db = new PortugalVillasContext()) { _db.PropertyRegions.Attach(propertyregion); _db.Entry(propertyregion).State = EntityState.Modified; _db.SaveChanges(); return(RedirectToAction("Edit", new { id = propertyregion.PropertyRegionID })); } } return(View(propertyregion)); }
public ActionResult Edit(PropertyOwnerRepresentative propertyownerrepresentative) { if (ModelState.IsValid) { using (var _db = new PortugalVillasContext()) { _db.PropertyOwnerRepresentatives.Attach(propertyownerrepresentative); _db.Entry(propertyownerrepresentative).State = EntityState.Modified; _db.SaveChanges(); return(RedirectToAction("Edit", new { id = propertyownerrepresentative.PropertyOwnerRepresentativeID })); } } return(View(propertyownerrepresentative)); }
public ActionResult Edit(BookingExtraAttribute bookingextraattribute) { if (ModelState.IsValid) { db.Entry(bookingextraattribute).State = EntityState.Modified; db.SaveChanges(); ViewBag.BookingExtraID = new SelectList(db.BookingExtras, "BookingExtraID", "LegacyReference", bookingextraattribute.BookingExtraID); ViewBag.BookingExtraTypeID = new SelectList(db.BookingExtraTypes, "BookingExtraTypeID", "ExtraTypeName"); return(RedirectToAction("BookingExtraAttributeListIndex", "BookingExtraAttribute", new { bookingExtraId = bookingextraattribute.BookingExtraID })); } ViewBag.BookingExtraID = new SelectList(db.BookingExtras, "BookingExtraID", "LegacyReference", bookingextraattribute.BookingExtraID); ViewBag.BookingExtraTypeID = new SelectList(db.BookingExtraTypes, "BookingExtraTypeID", "ExtraTypeName"); return(View(bookingextraattribute)); }
// // GET: /BookingExtraSelection/ public bool CancelBookingExtraSelection(long besID) { var bes = db.BookingExtraSelections.Find(besID); bes.Cancelled = true; if (ModelState.IsValid) { db.Entry(bes).State = EntityState.Modified; db.SaveChanges(); return(true); } return(false); }
public ActionResult Edit(PropertyTown propertytown) { if (ModelState.IsValid) { using (var _db = new PortugalVillasContext()) { _db.PropertyTowns.Attach(propertytown); _db.Entry(propertytown).State = EntityState.Modified; _db.SaveChanges(); ViewBag.PropertyRegionID = new SelectList(db.PropertyRegions, "PropertyRegionID", "RegionName", propertytown.PropertyRegionID); return(RedirectToAction("Edit", new { id = propertytown.PropertyTownID })); } } ViewBag.PropertyRegionID = new SelectList(db.PropertyRegions, "PropertyRegionID", "RegionName", propertytown.PropertyRegionID); return(View(propertytown)); }
public ActionResult Edit(BookingParticipant bookingparticipant) { var oldPart = db.BookingParticipants.Where(x => x.BookingParticipantID == bookingparticipant.BookingParticipantID).FirstOrDefault(); bookingparticipant.BookingParticipantWhenCreated = oldPart.BookingParticipantWhenCreated; if (ModelState.IsValid) { using (var _db = new PortugalVillasContext()) { _db.BookingParticipants.Attach(bookingparticipant); _db.Entry(bookingparticipant).State = EntityState.Modified; _db.SaveChanges(); return(RedirectToAction("Index", "BookingParticipant", new { bookingID = bookingparticipant.BookingID })); } } ViewBag.BookingID = new SelectList(db.Bookings, "BookingID", "BookingPRCReference", bookingparticipant.BookingID); return(View(bookingparticipant)); }
public ActionResult Edit(PropertyOwner propertyowner) { propertyowner.WhenCreated = DateTime.Now; propertyowner.WhenUpdated = db.PropertyOwners.Where(x => x.PropertyOwnerID == propertyowner.PropertyOwnerID).First().WhenUpdated; if (ModelState.IsValid) { using (var _db = new PortugalVillasContext()) { _db.PropertyOwners.Attach(propertyowner); _db.Entry(propertyowner).State = EntityState.Modified; _db.SaveChanges(); return(RedirectToAction("Edit", new { id = propertyowner.PropertyOwnerID })); } } return(View(propertyowner)); }
public ActionResult Edit(Customer customer) { var oldCust = db.Customers.Where(x => x.CustomerID == customer.CustomerID).First(); customer.CreationDate = customer.CreationDate; if (ModelState.IsValid) { using (var _db = new PortugalVillasContext()) { _db.Customers.Attach(customer); _db.Entry(customer).State = EntityState.Modified; _db.SaveChanges(); Session["currentCustomer"] = customer; return(RedirectToAction("Edit", customer)); } } return(View(customer)); }
public ActionResult ManageCustomerBankDetail(CustomerBankDetail aCustomerBankDetail) { try { PortugalVillasContext _dbContext = new PortugalVillasContext(); Customer customer = GetCustomerForLoggedInCustomerAndStoreInSession(HttpContext.User.Identity.Name); aCustomerBankDetail.CustomerID = customer.CustomerID; _dbContext.Entry(aCustomerBankDetail).State = EntityState.Modified; var objContext = ((IObjectContextAdapter)_dbContext).ObjectContext; var refreshableObjects = (from entry in objContext.ObjectStateManager.GetObjectStateEntries( EntityState.Added | EntityState.Deleted | EntityState.Modified | EntityState.Unchanged) where entry.EntityKey != null select entry.Entity); objContext.Refresh(RefreshMode.ClientWins, refreshableObjects); if (ModelState.IsValid) { if (objContext.SaveChanges() > 0) { ; } { return(View("CustomerUpdateSuccess")); } } } catch (Exception exception) { throw exception; } return(View("CustomerUpdateFailed")); }
public ActionResult Edit(BookingExtraParticipant bookingextraparticipant) { var old = db.BookingExtraParticipants.Where( c => c.BookingExtraSelectionID == bookingextraparticipant.BookingExtraSelectionID).FirstOrDefault(); bookingextraparticipant.BookingExtraParticipantWhenCreated = old.BookingExtraParticipantWhenCreated; if (ModelState.IsValid) { using (var _db = new PortugalVillasContext()) { _db.BookingExtraParticipants.Attach(bookingextraparticipant); _db.Entry(bookingextraparticipant).State = EntityState.Modified; _db.SaveChanges(); return(RedirectToAction("Index", new { BookingExtraSelectionId = bookingextraparticipant.BookingExtraSelectionID })); } } ViewBag.ID = (long)Session["recentBES"]; return(View(bookingextraparticipant)); }
public ActionResult Edit(BookingExtra bookingextra) { var oldExtra = db.BookingExtras.Where(x => x.BookingExtraID == bookingextra.BookingExtraID).First(); bookingextra.WhenCreated = oldExtra.WhenCreated; bookingextra.WhenModified = oldExtra.WhenModified; if (ModelState.IsValid) { using (var _db = new PortugalVillasContext()) { _db.BookingExtras.Attach(bookingextra); _db.Entry(bookingextra).State = EntityState.Modified; _db.SaveChanges(); ViewBag.BookingExtraTypeID = new SelectList(db.BookingExtraTypes, "BookingExtraTypeID", "ExtraTypeName", bookingextra.BookingExtraTypeID); return(RedirectToAction("SingleBookingExtraIndex", "BookingExtra", new { bookingextraID = bookingextra.BookingExtraID })); } } ViewBag.BookingExtraTypeID = new SelectList(db.BookingExtraTypes, "BookingExtraTypeID", "ExtraTypeName", bookingextra.BookingExtraTypeID); return(View(bookingextra)); }