Пример #1
0
        // To protect from overposting attacks, please 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());
            }

            _context.Attach(ScheduleData).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!ScheduleDataExists(ScheduleData.ScheduleId))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(RedirectToPage("./Index"));
        }
Пример #2
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"));
            }

            _context.Attach(FootballNoteData).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!FootballNoteDataExists(FootballNoteData.NoteId))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(RedirectToPage("./Index"));
        }
Пример #3
0
        public async Task Edit(PlaybookData data)
        {
            _context.Attach(data).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateException ex)
            {
                throw new ISSRepositoryException("Playbookのデータベースへの更新処理でエラーが発生しました。", ex);
            }
        }
Пример #4
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()
        {
            LoginUser = _sessionService.GetLoginUser(HttpContext);
            if (LoginUser == null)
            {
                return(RedirectToPage("/Login"));
            }

            if (!ModelState.IsValid)
            {
                return(Page());
            }

            _context.Attach(ScheduleAnswerData).State = EntityState.Modified;
            ScheduleAnswerData.LastUpdateDate         = DateTime.Now;

            var data     = this.ScheduleAnswerData;
            var schedule = _context.ScheduleData.Find(ScheduleAnswerData.ScheduleId);

            try
            {
                if (!ScheduleAnswerDataExists(ScheduleAnswerData.ScheduleId, LoginUser.UserId))
                {
                    _context.Add(ScheduleAnswerData);
                    await _context.SaveChangesAsync();

                    var message = "【スケジュール回答】\nスケジュール:" + schedule.StartDate.ToString("MM/dd") + ":" + schedule.Title + "\n"
                                  + LoginUser.UserName.NameKanji + " は、" + data.Answer + "と回答しました。\nコメント:" + data.Comment;
                    _lineNotifyService.SendMessage(message);
                }
                else
                {
                    await _context.SaveChangesAsync();

                    var message = "【スケジュール回答】\nスケジュール:" + schedule.StartDate.ToString("MM/dd") + ":" + schedule.Title + "\n"
                                  + LoginUser.UserName.NameKanji + " は、" + data.Answer + "に変更しました。\nコメント:" + data.Comment;
                    _lineNotifyService.SendMessage(message);
                }
            }
            catch (DbUpdateConcurrencyException)
            {
                throw;
            }

            return(RedirectToPage("/Index"));
        }