public ActionResult ProductCode(string code) { try { CustomIdentity customIdentity = (CustomIdentity)ControllerContext.HttpContext.User.Identity; if (string.IsNullOrEmpty(code)) { return(View(new Product())); } else { ProductBO productBO = new ProductBO(customIdentity.Name); Product product = productBO.GetProductsByCode(code); return(View(product)); } } catch (Exception ex) { throw new Exception(ex.Message); } }