/// <summary>
        /// Takes the string dictionary created by the JSON conversion and creates CrowdJudgementDatas objs, 
        /// which can be stored in the database and queried
        /// </summary>
        /// <param name="jsonData"></param>
        public async Task AddData(Dictionary<string, string> jsonData, CrowdContext DB)
        {
            Data = new List<CrowdJudgementData>();

            foreach (KeyValuePair<string, string> pair in jsonData)
            {
                CrowdJudgementData newData = new CrowdJudgementData
                {
                    CrowdJudgementId = this.Id,
                    DataType = pair.Key,
                    StringResponse = pair.Value
                };

                if (char.IsDigit(newData.StringResponse[0]))
                {
                    int num;
                    if (int.TryParse(newData.StringResponse, out num))
                    {
                        newData.NumResponse = num;
                    }
                }

                Data.Add(newData);
                DB.CrowdJudgementDatas.Add(newData);
            }

            try
            {
                await DB.SaveChangesAsync();
            }
            catch (Exception exception)
            {
                throw exception;
            }
        }
 public AuthorizeResourceFilter(CrowdContext context,
                                IAuthorizationService authorizationService,
                                Type requirementType,
                                Type resourceType,
                                string resourceNavigationProperty)
 {
     _context = context;
     _authorizationService       = authorizationService;
     _requirementType            = requirementType;
     _resourceType               = resourceType;
     _resourceNavigationProperty = resourceNavigationProperty;
 }
Beispiel #3
0
 public HomeController(CrowdContext context)
 {
     _context = context;
 }
Beispiel #4
0
 public CategoriesService(CrowdContext context)
 {
     _context = context;
 }
 public UserBackingsController(CrowdContext context, IAuthorizationService authorizationService)
 {
     _context = context;
     _authorizationService = authorizationService;
 }
Beispiel #6
0
 public BackingPackagesController(CrowdContext context)
 {
     _context = context;
 }
Beispiel #7
0
 public ProjectsController(CrowdContext context, IAuthorizationService authorizationService)
 {
     _context = context;
     _authorizationService = authorizationService;
 }