Esempio n. 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);
        }
Esempio n. 2
0
        public ActionResult Index()
        {
            var model = new ProductSettings();

            var producers = Producers.GetAll();
            var users     = UserRoles.GetByRoles(new List <string> {
                StaticValues.Writer
            });

            model.Producers = Mapper.Map <List <Public.ViewProducer> >(producers);
            model.Users     = Mapper.Map <List <UserShortInfo> >(users);

            return(View(model: model));
        }