// 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")); }
// 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")); }
// 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")); }
// 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.CategoryData.Add(CategoryData); await _context.SaveChangesAsync(); return(RedirectToPage("./Index")); }
public async Task <IActionResult> OnPostAsync(int?id) { if (id == null) { return(NotFound()); } ScheduleAnswerData = await _context.ScheduleAnswerData.FindAsync(id); if (ScheduleAnswerData != null) { _context.ScheduleAnswerData.Remove(ScheduleAnswerData); await _context.SaveChangesAsync(); } return(RedirectToPage("./Index")); }
public async Task <IActionResult> OnPostAsync(int?id) { LoginUser = _sessionService.GetLoginUser(HttpContext); if (LoginUser == null) { return(RedirectToPage("/Login")); } if (id == null) { return(NotFound()); } PlaybookData = await _context.PlaybookData.FindAsync(id); if (PlaybookData != null) { _context.PlaybookData.Remove(PlaybookData); await _context.SaveChangesAsync(); } return(RedirectToPage("./Index")); }
public async Task AddAsync(FootballNoteData data) { _context.FootballNoteData.Add(data); await _context.SaveChangesAsync(); }
public async Task AddAsync(UserData data) { _context.UserData.Add(data); await _context.SaveChangesAsync(); }
/// <summary> /// プレイブックの新規登録 /// </summary> /// <remarks>プレイデザイン画像があった場合、AWS S3に保存される。</remarks> /// <param name="playbook"></param> /// <param name="bucketPath"></param> public async Task Add(PlaybookData data) { _context.PlaybookData.Add(data); await _context.SaveChangesAsync(); }