Example #1
0
 public IActionResult IsPointValid([FromQuery] CreatePointSetting createPointSetting)
 {
     if (createPointSetting.Points == 0 || createPointSetting.Money == 0)
     {
         return(Ok(false));
     }
     return(Ok(!this._context.PointsSettings.Where(c => c.Money == createPointSetting.Money || c.Points == createPointSetting.Points).Any()));
 }
Example #2
0
        public IActionResult Create([FromBody] CreatePointSetting createPointSetting)
        {
            var isValid = IsPointValid(createPointSetting) as OkObjectResult;

            if (!(bool)isValid.Value)
            {
                return(Conflict());
            }
            var point = _mapper.Map <PointsSetting>(createPointSetting);

            this._context.Add(point);
            this._context.SaveChanges();
            return(Ok(_mapper.Map <PointSettingsDto>(point)));
        }