public async Task <IActionResult> PutDimActivity(string id, DimActivity dimActivity) { if (id != dimActivity.ActivityCode) { return(BadRequest()); } _context.Entry(dimActivity).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!DimActivityExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <ActionResult <DimActivity> > PostDimActivity(DimActivity dimActivity) { _context.DimActivity.Add(dimActivity); try { await _context.SaveChangesAsync(); } catch (DbUpdateException) { if (DimActivityExists(dimActivity.ActivityCode)) { return(Conflict()); } else { throw; } } return(CreatedAtAction("GetDimActivity", new { id = dimActivity.ActivityCode }, dimActivity)); }