public async Task <IActionResult> PutAttachmentsInbox([FromRoute] int id, [FromBody] AttachmentsInbox attachmentsInbox) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != attachmentsInbox.AttachmentsInboxId) { return(BadRequest()); } _context.Entry(attachmentsInbox).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!AttachmentsInboxExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> PostAttachmentsInbox([FromBody] AttachmentsInbox attachmentsInbox) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } _context.AttachmentsInbox.Add(attachmentsInbox); await _context.SaveChangesAsync(); return(CreatedAtAction("GetAttachmentsInbox", new { id = attachmentsInbox.AttachmentsInboxId }, attachmentsInbox)); }