Exemple #1
0
        public async Task <IActionResult> PutPointAsync(Guid id, [FromBody] RoundPointInputModel model)
        {
            if (default(Guid).Equals(id))
            {
                AddNotification("O Id da pontuação da rodada não foi informado.");
                return(ResponseInvalid());
            }

            if (ModelState.IsValid)
            {
                var roundPoint = new RoundPoint(model.Position, model.Point, model.PlayerId, model.RoundId);
                await _roundPointService.UpdateAsync(id, roundPoint);

                if (ValidOperation())
                {
                    return(NoContent());
                }

                return(ResponseInvalid());
            }

            NotifyModelStateError();

            return(ResponseInvalid());
        }
Exemple #2
0
        public async Task <IActionResult> PostPointAsync([FromBody] RoundPointInputModel model)
        {
            if (ModelState.IsValid)
            {
                var roundPoint = new RoundPoint(model.Position, model.Point, model.PlayerId, model.RoundId);
                await _roundPointService.AddAsync(roundPoint);

                if (ValidOperation())
                {
                    return(Created(GetRouteById(roundPoint.Id), new { id = roundPoint.Id }));
                }

                return(ResponseInvalid());
            }

            NotifyModelStateError();

            return(ResponseInvalid());
        }