Exemplo n.º 1
0
        public async Task <IActionResult> PutEarlyCompletion(int id, EarlyCompletion earlyCompletion)
        {
            if (id != earlyCompletion.EarlyCompletionId)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
Exemplo n.º 2
0
        public async Task <ActionResult <EarlyCompletionsPost> > PostEarlyCompletion(EarlyCompletionsPost earlyCompletionsPost)
        {
            var newEarlyCompletions = new EarlyCompletion {
                EarlyCompletionPhone = earlyCompletionsPost.EarlyCompletionPhone, EarlyCompletionCause = earlyCompletionsPost.EarlyCompletionCause, OtherInformation = earlyCompletionsPost.OtherInformation
            };

            _context.EarlyCompletions.Add(newEarlyCompletions);
            await _context.SaveChangesAsync();

            return(Ok());
        }