public ActionResult DeleteConfirmed(long id) { PropertyOwnerAccount propertyowneraccount = db.PropertyOwnerAccounts.Find(id); db.PropertyOwnerAccounts.Remove(propertyowneraccount); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult PropertyAccountTransactionIndex() { var created = PropertyOwnerAccount.CreateAccountsForOwnersWithoutAccount(db); var accounttransactions = db.AccountTransactions.Where(x => !x.BookingID.Equals(null)).Include(a => a.Booking).Include(a => a.BookingExtraSelection).Include(x => x.PropertyOwnerAccount.PropertyOwner.Properties); return(View("Index", accounttransactions.ToList())); }
// // GET: /PropertyOwnerAccount/Details/5 public ActionResult Details(long id = 0) { PropertyOwnerAccount propertyowneraccount = db.PropertyOwnerAccounts.Find(id); if (propertyowneraccount == null) { return(HttpNotFound()); } return(View(propertyowneraccount)); }
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)); }
// // GET: /PropertyOwnerAccount/Edit/5 public ActionResult Edit(long id = 0) { PropertyOwnerAccount propertyowneraccount = db.PropertyOwnerAccounts.Find(id); if (propertyowneraccount == null) { return(HttpNotFound()); } 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 SelectFromList(long id) { var accounts = db.PropertyOwnerAccounts.Include(x => x.PropertyOwner).ToSafeReadOnlyCollection(); ViewBag.PropertyOwnerAccount = accounts.Select(option => new SelectListItem { Text = (option == null ? "None" : ("OwnerID:" + option.PropertyOwnerID + "|| AccountID:" + option.AccountID + "|| Name:" + option.PropertyOwner.OwnerFirstName + " " + option.PropertyOwner.OwnerLastName + "|| Owns (first only):" + option.PropertyOwner.Properties.DefaultIfEmpty(new Property { LegacyReference = "" }).First().LegacyReference )), Value = option.AccountID.ToString() }); ViewBag.Transactions = db.AccountTransactions.Where(x => x.AccountID == id).ToSafeReadOnlyCollection(); ViewBag.BookingsWTrans = PropertyOwnerAccount.GetBookingsWithPaymentsOutstanding(id, db); ViewBag.BookingsPaid = PropertyOwnerAccount.GetBookingsPaid(id, db); return(View(accounts.First(x => x.AccountID == id))); }
public ActionResult Create(AccountTransaction accounttransaction) { if (ModelState.IsValid) { try { var created = PropertyOwnerAccount.CreateAccountsForOwnersWithoutAccount(db); var booking = db.Bookings.Find(accounttransaction.BookingID); var property = db.Properties.Include(x => x.PropertyOwner.PropertyOwnerAccounts) .Where(x => x.PropertyID == booking.PropertyID).FirstOrDefault(); accounttransaction.AccountID = property.PropertyOwner.PropertyOwnerAccounts.First().AccountID; accounttransaction.WhenCreated = DateTime.Now; accounttransaction.WhoCreated = User.Identity.Name; db.AccountTransactions.Add(accounttransaction); db.SaveChanges(); ViewBag.BookingID = new SelectList(db.Bookings, "BookingID", "BookingPRCReference", accounttransaction.BookingID); ViewBag.BookingExtraSelectionID = new SelectList(db.BookingExtraSelections, "BookingExtraSelectionID", "BookingExtraPRCReference", accounttransaction.BookingExtraSelectionID); return(RedirectToAction("Create")); } catch (Exception ex) { throw new Exception("Can't add a transaction!", ex); } } ViewBag.BookingID = new SelectList(db.Bookings, "BookingID", "BookingPRCReference", accounttransaction.BookingID); ViewBag.BookingExtraSelectionID = new SelectList(db.BookingExtraSelections, "BookingExtraSelectionID", "BookingExtraPRCReference", accounttransaction.BookingExtraSelectionID); return(View(accounttransaction)); }