Exemplo n.º 1
0
        // To protect from overposting attacks, enable the specific properties you want to bind to, for
        // more details, see https://aka.ms/RazorPagesCRUD.
        public async Task <IActionResult> OnPostAsync()
        {
            if (!ModelState.IsValid)
            {
                return(Page());
            }

            LoginUser = _sessionService.GetLoginUser(HttpContext);
            if (LoginUser == null)
            {
                return(RedirectToPage("/Login"));
            }

            try
            {
                NoteModel.TargetNoteId = TargetNoteId;
                var note = new FootballNote(NoteModel, LoginUser);
                await _footballNoteService.AddAsync(note);
            }
            catch (ISSModelException ex)
            {
                Message = ex.Message;
                return(Page());
            }
            catch (ISSServiceException ex)
            {
                Message = ex.Message;
                return(Page());
            }
            catch (ISSRepositoryException ex)
            {
                Message = ex.Message;
                return(Page());
            }

            return(RedirectToPage("./Index"));
        }
Exemplo n.º 2
0
        public FootballNote ToModel()
        {
            FootballNote note = new FootballNote(this);

            return(note);
        }