Example #1
0
        public async Task <IActionResult> PutAttachmentsSendbox([FromRoute] int id, [FromBody] AttachmentsSendbox attachmentsSendbox)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != attachmentsSendbox.AttachmentsSendboxId)
            {
                return(BadRequest());
            }

            _context.Entry(attachmentsSendbox).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!AttachmentsSendboxExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
Example #2
0
        public async Task <IActionResult> PostAttachmentsSendbox([FromBody] AttachmentsSendbox attachmentsSendbox)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            _context.AttachmentsSendbox.Add(attachmentsSendbox);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetAttachmentsSendbox", new { id = attachmentsSendbox.AttachmentsSendboxId }, attachmentsSendbox));
        }