public async Task <ActionResult> DeleteConfirmed(int id) { SiteSuper siteSuper = await db.SiteSupers.FindAsync(id); db.SiteSupers.Remove(siteSuper); await db.SaveChangesAsync(); return(RedirectToAction("Index")); }
public async Task <ActionResult> Edit([Bind(Include = "SiteSuperID,Name,Phone,Work")] SiteSuper siteSuper) { if (ModelState.IsValid) { db.Entry(siteSuper).State = EntityState.Modified; await db.SaveChangesAsync(); return(RedirectToAction("Index")); } return(View(siteSuper)); }
public async Task <ActionResult> Edit([Bind(Include = "SiteSuperID,Name,Phone,Work")] SiteSuper siteSuper) { if (ModelState.IsValid) { db.Entry(siteSuper).State = EntityState.Modified; await db.SaveChangesAsync(); AccountController.dynamicLogRecord(User.Identity.Name.ToString() + " finished editing. New values: " + "Site Super ID: " + siteSuper.SiteSuperID + " Site Super Name: " + siteSuper.Name + " Site Super Phone: " + siteSuper.Phone + " Site Super Work: " + siteSuper.Work, User.Identity.Name.ToString(), AccountController.setDynamicLog(User.Identity.Name)); return(RedirectToAction("Index")); } return(View(siteSuper)); }
public async Task <ActionResult> Create([Bind(Include = "SiteSuperID,Name,Phone,Work")] SiteSuper siteSuper) { if (ModelState.IsValid) { db.SiteSupers.Add(siteSuper); await db.SaveChangesAsync(); return(RedirectToAction("Index")); } return(View(siteSuper)); }
public async Task <ActionResult> Create([Bind(Include = "SiteSuperID,Name,Phone,Work")] SiteSuper siteSuper) { if (ModelState.IsValid) { db.SiteSupers.Add(siteSuper); await db.SaveChangesAsync(); AccountController.dynamicLogRecord(User.Identity.Name.ToString() + " created: " + "Site Super ID: " + siteSuper.SiteSuperID + " Site Super Name: " + siteSuper.Name + " Site Super Phone: " + siteSuper.Phone + " Site Super Work: " + siteSuper.Work, User.Identity.Name.ToString(), AccountController.setDynamicLog(User.Identity.Name)); return(RedirectToAction("Index")); } return(View(siteSuper)); }
// GET: SiteSupers/Details/5 public async Task <ActionResult> Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } SiteSuper siteSuper = await db.SiteSupers.FindAsync(id); if (siteSuper == null) { return(HttpNotFound()); } return(View(siteSuper)); }
// GET: SiteSupers/Edit/5 public async Task <ActionResult> Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } SiteSuper siteSuper = await db.SiteSupers.FindAsync(id); if (siteSuper == null) { return(HttpNotFound()); } AccountController.dynamicLogRecord(User.Identity.Name.ToString() + " is attempting to edit. Previous values: " + "Site Super ID: " + siteSuper.SiteSuperID + " Site Super Name: " + siteSuper.Name + " Site Super Phone: " + siteSuper.Phone + " Site Super Work: " + siteSuper.Work, User.Identity.Name.ToString(), AccountController.setDynamicLog(User.Identity.Name)); return(View(siteSuper)); }
public async Task <ActionResult> DeleteConfirmed(int id) { try { SiteSuper siteSuper = await db.SiteSupers.FindAsync(id); db.SiteSupers.Remove(siteSuper); await db.SaveChangesAsync(); AccountController.dynamicLogRecord(User.Identity.Name.ToString() + " deleted " + siteSuper.Name + " " + siteSuper.SiteSuperID, User.Identity.Name.ToString(), AccountController.setDynamicLog(User.Identity.Name)); return(RedirectToAction("Index")); } catch (DbUpdateException e) { Response.Write("<script language='javascript'>alert(" + e.Message + ")</script>"); logger.Error(e); return(RedirectToAction("Index")); } }