public async Task <ActionResult <EntryNotice> > PostEntryNotice(EntryNotice entryNotice) { _context.EntryNotice.Add(entryNotice); await _context.SaveChangesAsync(); return(CreatedAtAction("GetEntryNotice", new { id = entryNotice.id }, entryNotice)); }
public async Task <IActionResult> PutEntryNotice(int id, EntryNotice entryNotice) { if (id != entryNotice.id) { return(BadRequest()); } _context.Entry(entryNotice).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!EntryNoticeExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public ActionResult Notice(int entryid, int userid, int subjectid, string notice) { EntryNotice entryNotice = new EntryNotice(); entryNotice.id = 0; entryNotice.entryId = entryid; entryNotice.noticedById = userid; entryNotice.notice = notice; var apiendpoint = $"/entrynotices/notice"; _helper.PostMethod <EntryNotice>(entryNotice, apiendpoint); return(Redirect($"/subject?search={_helper.GetSubjectNameById(subjectid)}")); }