public async void Save(MeetingsQuestions entry) { if (entry.Id == 0) { this.context.MeetingsQuestions.Add(entry); } else { MeetingsQuestions dbEntry = await this.context.MeetingsQuestions.FirstOrDefaultAsync(x => x.Id == entry.Id); if (dbEntry != null) { dbEntry.DirectorsGroup = entry.DirectorsGroup; dbEntry.InverseParentQuestion = entry.InverseParentQuestion; dbEntry.Meeting = entry.Meeting; dbEntry.MeetingsDirectories = entry.MeetingsDirectories; dbEntry.MeetingsQuestionsL = entry.MeetingsQuestionsL; dbEntry.MeetingsQuestionsSpeakers = entry.MeetingsQuestionsSpeakers; dbEntry.MeetingsVotes = entry.MeetingsVotes; dbEntry.ParentQuestion = entry.ParentQuestion; dbEntry.UpdDate = entry.UpdDate; dbEntry.UpdUser = entry.UpdUser; } } await this.context.SaveChangesAsync(); }
public async Task <IActionResult> DeleteConfirmed(long id = 0) { //MeetingsQuestions meetingsQuestions = await _context.MeetingsQuestions.SingleAsync(m => m.Id == id); //_context.MeetingsQuestions.Remove(meetingsQuestions); //await _context.SaveChangesAsync(); MeetingsQuestions meetingsQuestions = await this._context.GetAsync(id); var result = await this._context.DeleteAsync(meetingsQuestions); return(RedirectToAction("Index", result)); }
public async Task <MeetingsQuestions> Delete(int id) { MeetingsQuestions dbEntry = await this.context.MeetingsQuestions.FirstOrDefaultAsync(x => x.Id == id); if (dbEntry != null) { this.context.MeetingsQuestions.Remove(dbEntry); await this.context.SaveChangesAsync(); } return(dbEntry); }
public IActionResult Create(MeetingsQuestions meetingsQuestions) { if (ModelState.IsValid) { var user = this._users.Get(3); meetingsQuestions.UpdUserId = user.Id; this._context.Add(meetingsQuestions); return(RedirectToAction("Index")); } //ViewData["DirectorsGroupId"] = new SelectList(_context.DictDirectorsGroups, "Id", "DirectorsGroup", meetingsQuestions.DirectorsGroupId); //ViewData["MeetingId"] = new SelectList(_context.Meetings, "Id", "Meeting", meetingsQuestions.MeetingId); //ViewData["ParentQuestionId"] = new SelectList(_context.MeetingsQuestions, "Id", "ParentQuestion", meetingsQuestions.ParentQuestionId); //ViewData["UpdUserId"] = new SelectList(this._users, "Id", "UpdUser", meetingsQuestions.UpdUserId); return(View(meetingsQuestions)); }
public async Task <IActionResult> Details(long id = -1) { if (id == -1) { return(HttpNotFound()); } MeetingsQuestions meetingsQuestions = await _context.GetAsync(id); if (meetingsQuestions == null) { return(HttpNotFound()); } return(View(meetingsQuestions)); }
public async Task <IActionResult> Delete(long id = 0) { if (id >= 0) { return(HttpNotFound()); } MeetingsQuestions meetingsQuestions = await this._context.GetAsync(id); if (meetingsQuestions == null) { return(HttpNotFound()); } return(View(meetingsQuestions)); }
// GET: MeetingsQuestions/Edit/5 public async Task <IActionResult> Edit(long id = 0) { if (id < 0) { return(HttpNotFound()); } //MeetingsQuestions meetingsQuestions = this._context.Get(id); MeetingsQuestions meetingsQuestions = await this._context.GetAsync(id); if (meetingsQuestions == null) { return(HttpNotFound()); } //ViewData["DirectorsGroupId"] = new SelectList(_context.DictDirectorsGroups, "Id", "DirectorsGroup", meetingsQuestions.DirectorsGroupId); //ViewData["MeetingId"] = new SelectList(_context.Meetings, "Id", "Meeting", meetingsQuestions.MeetingId); //ViewData["ParentQuestionId"] = new SelectList(_context.MeetingsQuestions, "Id", "ParentQuestion", meetingsQuestions.ParentQuestionId); //ViewData["UpdUserId"] = new SelectList(_context.Users, "Id", "UpdUser", meetingsQuestions.UpdUserId); return(View(meetingsQuestions)); }
public IActionResult Edit(MeetingsQuestions meetingsQuestions) { if (ModelState.IsValid) { //_context.Update(meetingsQuestions); //await _context.SaveChangesAsync(); try { this._context.Update(meetingsQuestions); return(RedirectToAction("Index")); } catch (Exception ex) { } } //ViewData["DirectorsGroupId"] = new SelectList(_context.DictDirectorsGroups, "Id", "DirectorsGroup", meetingsQuestions.DirectorsGroupId); //ViewData["MeetingId"] = new SelectList(_context.Meetings, "Id", "Meeting", meetingsQuestions.MeetingId); //ViewData["ParentQuestionId"] = new SelectList(_context.MeetingsQuestions, "Id", "ParentQuestion", meetingsQuestions.ParentQuestionId); //ViewData["UpdUserId"] = new SelectList(_context.Users, "Id", "UpdUser", meetingsQuestions.UpdUserId); return(View(meetingsQuestions)); }