Beispiel #1
0
        public async Task <IActionResult> OnPostAsync(UploadInputModel model)
        {
            if (!ModelState.IsValid)
            {
                return(Page());
            }

            var result = await UploadService.AddAnimation(new Application.Models.UploadModel()
            {
                Name        = model.Name,
                Description = model.Description,
                Price       = model.Price,
                File        = await model.File.GetBytes(),
                UserId      = IdentityService.GetUserId() ?? Guid.Empty
            });

            if (result != null && result.Count > 0)
            {
                foreach (var error in result)
                {
                    ModelState.AddModelError("", error);
                }
            }
            else
            {
                ShowSuccess = true;
            }

            return(Page());
        }