Esempio n. 1
0
        public async Task <IActionResult> PutReferralState(string id, ReferralState referralState)
        {
            if (id != referralState.ReferralId)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
Esempio n. 2
0
        public async Task <ActionResult <ReferralState> > PostReferralState(ReferralState referralState)
        {
            _context.ReferralStates.Add(referralState);
            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateException)
            {
                if (ReferralStateExists(referralState.ReferralId))
                {
                    return(Conflict());
                }
                else
                {
                    throw;
                }
            }

            return(CreatedAtAction("GetReferralState", new { id = referralState.ReferralId }, referralState));
        }