Пример #1
0
        public async Task <IActionResult> DeletePlayerGroup([FromBody] PlayerGroupViewModel model)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    PlayerGroup playergroup = new PlayerGroup()
                    {
                        GroupId              = model.GroupId,
                        PlayerId             = model.PlayerId,
                        IsInvitationAccepted = model.IsInvitationAccepted
                    };

                    await _groupManager.DeletePlayerGroup(playergroup);

                    return(Ok(ApiResponse(ApiResponseStatus.Success, playergroup, $@"group invitation successfully deleted.")));
                }

                return(BadRequest(ApiResponse(ApiResponseStatus.Fail, GetModelStateErrors(ModelState), "Model validation failure.")));
            }

            catch (Exception e)
            {
                _logger.LogError(e.Message);
                return(HandleException("1", e, "An error occurred while updating record. Please try again later."));
            }
        }