public async Task <IActionResult> PutCapitalRegistration([FromRoute] int id, [FromBody] CapitalRegistration capitalRegistration) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != capitalRegistration.CapitalRegistrationId) { return(BadRequest()); } _context.Entry(capitalRegistration).State = EntityState.Modified; try { await _context.SaveChangesAsync(); return(CreatedAtAction("PutCapitalRegistration", capitalRegistration)); } catch (DbUpdateConcurrencyException) { if (!CapitalRegistrationExists(id)) { return(NotFound()); } throw; } return(NoContent()); }
public async Task <IActionResult> PostCapitalRegistration([FromBody] CapitalRegistration capitalRegistration) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } var editedCapitalRegistration = capitalRegistration; editedCapitalRegistration.IsActive = true; _context.CapitalRegistrations.Add(editedCapitalRegistration); await _context.SaveChangesAsync(); return(CreatedAtAction("GetCapitalRegistration", new { id = capitalRegistration.CapitalRegistrationId }, capitalRegistration)); }