// GET: Components/Details/5 public ActionResult Details(int id) { LogicBlock lb = ProcessConnectionManager.GetLogicBlock(id); if (lb != null) { return(View(lb)); } else { LogicBlock lb_Error = new LogicBlock(); lb_Error.ID = -1; lb_Error.Item = string.Empty; lb_Error.Tag = string.Empty; lb_Error.TypeName = "not found"; lb_Error.Designation = "Component could not be located"; return(View(lb_Error)); } }
// GET: Components public ActionResult Index(string searchString) { LogicBlock[] lbs = ProcessConnectionManager.GetLogicBlocks(); if (lbs == null) { LogicBlock lb_Error = new LogicBlock(); lb_Error.ID = -1; lb_Error.TypeName = "error. nothing found"; lbs = new LogicBlock[1] { lb_Error }; return(View(lb_Error)); } else { if (!String.IsNullOrEmpty(searchString)) { lbs = lbs.Where(s => s.ID.ToString().Contains(searchString) || s.TypeName.Contains(searchString)).ToArray(); } } return(View(lbs)); }