public async Task <IActionResult> PutTpLocations(Guid id, TpLocations tpLocations) { if (id != tpLocations.LocId) { return(BadRequest()); } _context.Entry(tpLocations).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!TpLocationsExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <ActionResult <TpLocations> > PostTpLocations(TpLocations tpLocations) { _context.TpLocations.Add(tpLocations); try { await _context.Database.ExecuteSqlRawAsync("tpsrv_logon", new SqlParameter("@Login", "sa"), new SqlParameter("@Password", "tillypad")); await _context.SaveChangesAsync(); } catch (DbUpdateException) { if (TpLocationsExists(tpLocations.LocId)) { return(Conflict()); } else { throw; } } return(CreatedAtAction("GetTpLocations", new { id = tpLocations.LocId }, tpLocations)); }