public JsonResult HidePosition(HideModel hideModel) { Console.WriteLine("Hiding ID:\t{0} ::\ttype: {1}", hideModel.Id, hideModel.Id.GetType()); try { Position p = _context.Positions.SingleOrDefault(a => a.PositionId == hideModel.Id); if (p == null) { return(Json(new { message = "Null" })); } p.Hidden = true; _context.SaveChanges(); } catch (Exception e) { return(Json("User delete failed. " + e)); } return(Json(hideModel.Id)); }
public JsonResult HideBank(HideModel hideModel) { Console.WriteLine("Hiding ID:\t{0} ::\ttype: {1}", hideModel.Id, hideModel.Id.GetType()); try { Bank b = _context.Banks.FirstOrDefault(a => a.BankId == hideModel.Id); if (b == null) { return(Json(new { message = "Null" })); } b.Hidden = true; _context.SaveChanges(); } catch (Exception e) { return(Json("Bank delete failed. " + e)); } return(Json(hideModel.Id)); }