public ActionResult DeleteConfirmed(int id) { AgencyOffice agencyOffice = db.AgencyOffices.Find(id); db.AgencyOffices.Remove(agencyOffice); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "FK_agencyID,FK_addressID,FK_ContactInfoID")] AgencyOffice agencyOffice) { if (ModelState.IsValid) { db.Entry(agencyOffice).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.FK_addressID = new SelectList(db.Addresses, "Address_ID", "Address_address", agencyOffice.FK_addressID); ViewBag.FK_agencyID = new SelectList(db.Agencies, "Agency_ID", "Agency_name", agencyOffice.FK_agencyID); ViewBag.FK_ContactInfoID = new SelectList(db.OfficeContactInformations, "ContactInfo_ID", "ContactInfo_phoneNo", agencyOffice.FK_ContactInfoID); return(View(agencyOffice)); }
// GET: AgencyOffices/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } AgencyOffice agencyOffice = db.AgencyOffices.Find(id); if (agencyOffice == null) { return(HttpNotFound()); } return(View(agencyOffice)); }
public async Task <IActionResult> OnGetAsync(Guid?id) { if (id == null) { return(NotFound()); } AgencyOffice = await _context.AgencyOffices .Include(a => a.Person).FirstOrDefaultAsync(m => m.Id == id); if (AgencyOffice == null) { return(NotFound()); } return(Page()); }
public async Task <IActionResult> OnPostAsync(Guid?id) { if (id == null) { return(NotFound()); } AgencyOffice = await _context.AgencyOffices.FindAsync(id); if (AgencyOffice != null) { AgencyOffice.IsDeleted = true; await _context.SaveChangesAsync(); } return(RedirectToPage("./Index")); }
public async Task <IActionResult> OnGetAsync(Guid?id) { if (id == null) { return(NotFound()); } AgencyOffice = await _context.AgencyOffices .Include(a => a.Person).FirstOrDefaultAsync(m => m.Id == id); if (AgencyOffice == null) { return(NotFound()); } //ViewData["PersonId"] = new SelectList(_context.People, "Id", "SurnameInitials"); return(Page()); }
// GET: AgencyOffices/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } AgencyOffice agencyOffice = db.AgencyOffices.Find(id); if (agencyOffice == null) { return(HttpNotFound()); } ViewBag.FK_addressID = new SelectList(db.Addresses, "Address_ID", "Address_address", agencyOffice.FK_addressID); ViewBag.FK_agencyID = new SelectList(db.Agencies, "Agency_ID", "Agency_name", agencyOffice.FK_agencyID); ViewBag.FK_ContactInfoID = new SelectList(db.OfficeContactInformations, "ContactInfo_ID", "ContactInfo_phoneNo", agencyOffice.FK_ContactInfoID); return(View(agencyOffice)); }