public async Task <IActionResult> PutMtnReligion([FromRoute] int id, [FromBody] MtnReligion mtnReligion) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != mtnReligion.ReligionId) { return(BadRequest()); } _context.Entry(mtnReligion).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!MtnReligionExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> PostMtnReligion([FromBody] MtnReligion mtnReligion) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } _context.MtnReligion.Add(mtnReligion); await _context.SaveChangesAsync(); return(CreatedAtAction("GetMtnReligion", new { id = mtnReligion.ReligionId }, mtnReligion)); }