コード例 #1
0
ファイル: NotesController.cs プロジェクト: mrjohndowe/Core
        public async Task <IActionResult> NewNote(NewNoteView model, CancellationToken cancellationToken)
        {
            if (ModelState.IsValid)
            {
                Note note = new Note();
                note.DepartmentId = DepartmentId;
                note.UserId       = UserId;
                note.AddedOn      = DateTime.UtcNow;
                note.Title        = model.Title;
                note.Body         = System.Net.WebUtility.HtmlDecode(model.Body);

                if (ClaimsAuthorizationHelper.IsUserDepartmentAdmin())
                {
                    note.IsAdminOnly = bool.Parse(model.IsAdminOnly);
                }
                else
                {
                    note.IsAdminOnly = false;
                }

                note.Category = model.Category;

                await _notesService.SaveAsync(note, cancellationToken);

                return(RedirectToAction("Index", "Notes", new { Area = "User" }));
            }

            return(View(model));
        }
コード例 #2
0
ファイル: NotesController.cs プロジェクト: mrjohndowe/Core
        public async Task <IActionResult> NewNote()
        {
            NewNoteView model = new NewNoteView();

            return(View(model));
        }
コード例 #3
0
ファイル: NotesController.cs プロジェクト: mrpastewart/Core
        public IActionResult NewNote()
        {
            NewNoteView model = new NewNoteView();

            return(View(model));
        }