public ActionResult Get(int id) { try { if (objAutorized.ValidateTokenResult == null) { return(Ok(new CommonResponse() { error_code = Convert.ToInt32(ErrorCode.Failure), message = "Invalid access." })); } if (objAutorized.ValidateTokenResult.isValid == false) { return(Ok(new CommonResponse() { error_code = Convert.ToInt32(ErrorCode.Failure), message = objAutorized.ValidateTokenResult.error_message })); } ProductDBAccess obj = ProductDBAccess.getInstance; List <ProductTable> objListData = obj.GetProductById(id); if (objListData.Count == 0) { return(Ok(new CommonResponse() { error_code = Convert.ToInt32(ErrorCode.Failure), message = "Product not found." })); } return(Ok( new ProductResponse.SelectData() { data = objListData, error_code = Convert.ToInt32(ErrorCode.Success), message = "Product data found." } )); } catch (Exception ex) { return(Ok(new CommonResponse() { error_code = Convert.ToInt32(ErrorCode.Failure), message = ex.Message })); } }
public Product GetProductById(int id) { return(productDb.GetProductById(id)); }