示例#1
0
        public JsonResult FilterProducers(List <int> groups)
        {
            var jsonSuccessResult = new JsonSuccessResult();

            try
            {
                if (groups != null && groups.Count > 0)
                {
                    jsonSuccessResult.Data = Producers.GetByGroupIDs(groups);
                }
                else
                {
                    jsonSuccessResult.Data = Producers.GetAll();
                }

                jsonSuccessResult.Success = true;
            }
            catch (Exception ex)
            {
                jsonSuccessResult.Errors  = new string[] { ex.Message };
                jsonSuccessResult.Success = false;
            }


            JsonResult result = new JsonResult()
            {
                Data = jsonSuccessResult
            };

            return(result);
        }
示例#2
0
        public JsonResult GetProducers(List <int> groupIDs)
        {
            var jsonSuccessResult = new JsonSuccessResult();

            try
            {
                jsonSuccessResult.Data    = Producers.GetByGroupIDs(groupIDs);
                jsonSuccessResult.Success = true;
            }
            catch (Exception ex)
            {
                jsonSuccessResult.Errors  = new string[] { ex.Message };
                jsonSuccessResult.Success = false;
            }

            return(new JsonResult()
            {
                Data = jsonSuccessResult
            });
        }