Пример #1
0
        public async Task <IActionResult> PutResponse([FromRoute] long id, [FromBody] Response response)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != response.Id)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
Пример #2
0
        public async Task <ActionResult <Response> > PostResponse([FromBody] Response item)
        {
            _context.Responses.Add(item);
            await _context.SaveChangesAsync();

            OnResponseAdded?.Invoke(item);

            return(Created("api/response", item));
        }
Пример #3
0
        public async Task <IActionResult> Create([Bind("HeaderId,FileName,FileType,SubmitterName,SubmissionDate,ValidationStatus,Levels,ResponseHierarchy,SchemaVersion,RecordYear,RecordMonth")] McpdipHeader mcpdipHeader)
        {
            if (ModelState.IsValid)
            {
                _context.Add(mcpdipHeader);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(mcpdipHeader));
        }