Exemplo n.º 1
0
        public bool Valid(ResourceBundleArgs args)
        {
            if (args == null)
            {
                return(false);
            }

            if (args.IsolationPeriodDays < 1) //TODO range?
            {
                return(false);
            }

            if (args.Release.Year < 2020) //TODO range?
            {
                return(false);
            }

            var locales = args.Text.Select(x => x.Key).ToArray();

            if (locales.Any(x => !LocalValid(x)))
            {
                return(false);
            }

            if (locales.Distinct().Count() != locales.Length)
            {
                return(false);
            }

            return(args.Text.All(x => Valid(x.Value)));
        }
Exemplo n.º 2
0
        public async Task Execute(ResourceBundleArgs args)
        {
            var e = new ResourceBundleContentEntity
            {
                Release = args.Release
            };
            await _Formatter.Fill(e, args.ToContent());

            await _DbContext.AddAsync(e);
        }
        public async Task <IActionResult> Execute(ResourceBundleArgs args)
        {
            if (!_Validator.Valid(args))
            {
                return(new BadRequestResult());
            }

            await _Writer.Execute(args);

            return(new OkResult());
        }