Example #1
0
        public IHttpActionResult getCategories(eventsDTO dto)
        {
            try {
                var helper = new HelperFunctions();

                // get all of an event's AgeGroup names
                var categoryList = _unitOfWork.Category.GetEventsCategories(dto.eventName);
                var AgeGroupList = categoryList.Select(c => c.Category);
                var catNames     = new List <object>();
                // Get all of categories 'Display Name'
                foreach (var group in AgeGroupList)
                {
                    var num = (int)group;

                    var         attrs       = helper.getEnumDisplayAnnotaion(group, num);
                    categoryDTO categoryDTO = new categoryDTO(num, ((DisplayAttribute)attrs[0]).Name);
                    catNames.Add(categoryDTO);
                }

                return(Ok(new JavaScriptSerializer().Serialize(catNames)));
            }
            catch
            {
                return(BadRequest());
            }
        }
        public IHttpActionResult GetParticipants(eventsDTO dto)
        {
            var vm = _unitOfWork.Participants.AllParticipantsInCategory(dto.eventName, dto.catValue);

            if (vm != null)
            {
                return(Ok(vm));
            }
            else
            {
                return(BadRequest());
            }
        }