Ejemplo n.º 1
0
        public async Task <IActionResult> PostFundingProgramInternalUser([FromBody] FundingProgramInternalUser fundingProgramInternalUser)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            _context.FundingProgramInternalUser.Add(fundingProgramInternalUser);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetFundingProgramInternalUser", new { id = fundingProgramInternalUser.FundingProgramInternalUserId }, fundingProgramInternalUser));
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> PutFundingProgramInternalUser([FromRoute] Guid id, [FromBody] FundingProgramInternalUser fundingProgramInternalUser)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != fundingProgramInternalUser.FundingProgramInternalUserId)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }