public async Task <IActionResult> Create([Bind("ID,Question,QuestionID,Authors,QuestionDate,Answer")] QOTDAnswerCreateEditViewModel QOTDAnswerVM, IFormCollection form) { Debug.Print(QOTDAnswerVM.QuestionID.ToString()); //not sure I want to allow multiple authors // need to swich to creating a different row for each author instead of saving multiple author ids string AuthorIds = ""; foreach (string item in form["Authors"]) { string ite = item; AuthorIds += ite + ",,"; } QOTDAnswer qOTDAnswer = new QOTDAnswer(); qOTDAnswer.Question = QOTDAnswerVM.Question; qOTDAnswer.QuestionID = QOTDAnswerVM.QuestionID; qOTDAnswer.Answer = QOTDAnswerVM.Answer; qOTDAnswer.QuestionDate = QOTDAnswerVM.QuestionDate; qOTDAnswer.Author = AuthorIds; Debug.Print(qOTDAnswer.Author); if (ModelState.IsValid) { _context.Add(qOTDAnswer); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(qOTDAnswer)); }
public async Task <IActionResult> Create([Bind("id,MetroArea,YearBuilt,insertionDate,Creator,RecentEdit")] REProperty rEProperty) { if (ModelState.IsValid) { _context.Add(rEProperty); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(rEProperty)); }
public async Task <IActionResult> Create([Bind("id,Question,QuestionAuthor,QuestionDate,Theme")] ParticipantQOTD Participant) { if (ModelState.IsValid) { _context.Add(Participant); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(Participant)); }
public async Task <IActionResult> Create([Bind("id,Contractorid,MetroArea,ZipCode,ProjectType,FreeformDescription,insertionDate,Creator")] REProject rEProject) { if (ModelState.IsValid) { _context.Add(rEProject); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(rEProject)); }
public async Task <IActionResult> Create([Bind("id,CreditScore,Lease,Month2Month,FamilyLetter,insertionDate,Creator")] Renter renter) { if (ModelState.IsValid) { _context.Add(renter); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(renter)); }
public async Task <IActionResult> Create([Bind("id,ContractorName,MetroArea,ZipCode,Specialty,insertionDate,Creator")] Contractor contractor) { if (ModelState.IsValid) { _context.Add(contractor); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(contractor)); }