Exemplo n.º 1
0
        public async Task <IActionResult> UpdateFlag(int id, [FromBody] DtoFlagUpdate update)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest());
            }

            return(await flags.ReplaceFeatureFlag(new FeatureFlag {
                FlagId = id,
                Name = update.Name,
                Description = update.Description,
                Value = update.Value
            })
                   .OnBoth(f => f.IsSuccess ? StatusCode(200) : StatusCode(500))
                   .ConfigureAwait(false));
        }
Exemplo n.º 2
0
        public async Task <IActionResult> CreateFlag([FromBody] DtoFlagUpdate update)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest());
            }

            return(await flags.CreateFeatureFlag(new FeatureFlag
            {
                Name = update.Name,
                Description = update.Description,
                Value = update.Value
            })
                   .Ensure(f => f.HasValue, "Flag created")
                   .OnBoth(f => f.IsSuccess ? StatusCode(200) : StatusCode(500))
                   .ConfigureAwait(false));
        }