Пример #1
0
        public async Task <ActionResult <string> > CreateNewGroupAsync(GroupUploadModel groupUploadModel)
        {
            try
            {
                if (await IsUserValidAsync())
                {
                    if (!GroupModel.IsGroupUploadModelValid(groupUploadModel))
                    {
                        return(BadRequest());
                    }

                    var groupIdentifier = await GroupModel.CreateNewGroupAsync(
                        groupUploadModel,
                        ExtractUserIdFromToken(),
                        RepositoryManager);

                    return(Ok(groupIdentifier));
                }
                else
                {
                    return(Unauthorized());
                }
            }
            catch (Exception err)
            {
                LogException(err);

                return(Problem());
            }
        }