public IActionResult SaveOwnerField(OwnerPageField ownerPageField) { try { if (ownerPageField != null) { db.OwnerPageFields.Update(ownerPageField); db.SaveChanges(); } return(RedirectToAction("Index", "Settings")); } catch (Exception ex) { LogFilter.Write(db, HttpContext.Request.QueryString.ToString(), HttpContext.Request.Path, HttpContext.Session.GetString("UserID"), ex); return(View("Error", ex)); } }
public IActionResult DeleteOwnerField(string FieldID) { _ = !String.IsNullOrEmpty(FieldID) ? FieldID : throw new NullReferenceException(); try { OwnerPageField OwnerPageField = this.db.OwnerPageFields.FirstOrDefault(e => e.FieldID == Guid.Parse(FieldID)); if (OwnerPageField == null) { LogFilter.Write(db, HttpContext.Request.QueryString.ToString(), HttpContext.Request.Path, HttpContext.Session.GetString("UserID"), new Exception($"Could not find Owner Field with specified ID ({FieldID})")); return(View("Error", new Exception($"Could not find Owner Field with specified ID ({FieldID})"))); } OwnerPageField.isDeleted = true; db.OwnerPageFields.Update(OwnerPageField); db.SaveChanges(); return(RedirectToAction("Index", "Settings")); } catch (Exception ex) { LogFilter.Write(db, HttpContext.Request.QueryString.ToString(), HttpContext.Request.Path, HttpContext.Session.GetString("UserID"), ex); return(View("Error", ex)); } }