public async Task <IActionResult> Edit(int id, [Bind("CoverLetterID,JobID,CoverLetterText")] CoverLetter coverLetter) { if (id != coverLetter.CoverLetterID) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(coverLetter); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CoverLetterExists(coverLetter.CoverLetterID)) { return(NotFound()); } else { throw; } } return(RedirectToAction("Index")); } return(View(coverLetter)); }
public async Task <IActionResult> PutCoverLetter([FromRoute] int id, [FromBody] CoverLetter coverLetter) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != coverLetter.CoverLetterID) { return(BadRequest()); } _context.Entry(coverLetter).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CoverLetterExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public static Page CreatePage(string pageType) { Console.WriteLine($"Creating a {pageType} page."); Page page = null; switch (pageType.ToLower()) { case "cover letter": page = new CoverLetter(); break; case "references": page = new References(); break; case "work history": page = new WorkHistory(); break; case "summary": page = new Summary(); break; default: break; } return(page); }
public async Task <IActionResult> Create([Bind("CoverLetterID,JobID,CoverLetterText")] CoverLetter coverLetter) { if (ModelState.IsValid) { _context.Add(coverLetter); await _context.SaveChangesAsync(); return(RedirectToAction("Index")); } return(View(coverLetter)); }
public async Task <IActionResult> PostCoverLetter([FromBody] CoverLetter coverLetter) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } _context.CoverLetters.Add(coverLetter); await _context.SaveChangesAsync(); return(CreatedAtAction("GetCoverLetter", new { id = coverLetter.CoverLetterID }, coverLetter)); }
static void Main(string[] args) { Console.WriteLine("Press Enter to Build Resume"); Console.ReadKey(); Document[] documents = new Document[2]; documents[0] = new Resume(); Console.WriteLine("Press Enter to Build a Cover Letter"); Console.ReadKey(); documents[1] = new CoverLetter(); Console.Read(); }
public static Document CreateDocument(string documentType) { Document doc = null; switch (documentType.ToLower()) { case "coverletter": doc = new CoverLetter(); break; case "resume": doc = new Resume(); break; default: break; } return(doc); }