コード例 #1
0
ファイル: Index.cshtml.cs プロジェクト: jimmychang94/Wordify
        /// <summary>
        /// SaveNoteAsync - Saves the current note into Note Database and Uploads Image and Response text to Blob storage.
        /// </summary>
        /// <returns></returns>
        public async Task <IActionResult> OnPostSaveNoteAsync([FromForm] byte[] byteData, [FromForm] string text, [FromForm] string title)
        {
            var user = await _userManager.GetUserAsync(User);

            Note note = new Note()
            {
                UserID     = user.Id,
                Date       = DateTime.Now,
                Title      = title,
                BlobLength = byteData.Length,
            };

            await _blob.Upload(note, text, byteData);

            await _note.CreateNote(note);

            return(RedirectToPage());
        }