示例#1
0
 public IHttpActionResult GetItemModels(string itemName, string modelNumber, string brand, int?quantity, string quanitySymbol, int?threshold, string thresholdSymbol, int?page, int?count)
 {
     try
     {
         using (MaxMasterDbEntities db = new MaxMasterDbEntities())
         {
             var itemModels = db.GetItemModels(itemName, modelNumber, brand, quantity, quanitySymbol, threshold, thresholdSymbol, page, count).OrderBy(x => x.ItemName).ToList();
             int totalCount = 0;
             if (itemModels.Count > 0)
             {
                 totalCount = (int)itemModels.FirstOrDefault().TotalCount;
             }
             return(Content(HttpStatusCode.OK, new { itemModels, totalCount }));
         }
     }
     catch (Exception ex)
     {
         new Error().logAPIError(System.Reflection.MethodBase.GetCurrentMethod().Name, ex.ToString(), ex.StackTrace);
         return(Content(HttpStatusCode.InternalServerError, "An error ocuured, please try again later"));
     }
 }