Ejemplo n.º 1
0
        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));
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> NewNote()
        {
            NewNoteView model = new NewNoteView();

            return(View(model));
        }
Ejemplo n.º 3
0
        public IActionResult NewNote()
        {
            NewNoteView model = new NewNoteView();

            return(View(model));
        }