public int Delete(EndpointEntity entpoint) { using (var db = new SqlConnection(_config)) { const string sql = "UPDATE Endpoints SET IsDeleted = 1 WHERE Id = @Id"; return(db.Execute(sql, entpoint)); } }
public int Update(EndpointEntity entpoint) { using (var db = new SqlConnection(_config)) { const string sql = "UPDATE Endpoints SET Name = @Name, Description = @Description, Version = @Version, Path = @Path, RestType = @RestType " + "WHERE Id = @Id AND EndpointId = @EndpointId"; return(db.Execute(sql, entpoint)); } }
public int Insert(EndpointEntity entpoint) { using (var db = new SqlConnection(_config)) { const string sql = "INSERT INTO Endpoints (Name, Description, Version, Path, RestType, ApplicationId, IsDeleted) " + "VALUES(@Name, @Description, @Version, @Path, @RestType, @ApplicationId, 0)"; return(db.Execute(sql, entpoint)); } }
public void Delete(EndpointEntity endpoint) { var updateCount = _dataTypesRepo.Delete(endpoint); if (updateCount == 0) { throw new Exception("endpoint was not deleted"); } }
public void Update(EndpointEntity endpoint) { endpoint.IsDeleted = false; var updateCount = _dataTypesRepo.Update(endpoint); if (updateCount == 0) { throw new Exception("endpoint was not updated"); } }
public void Create(EndpointEntity endpoint) { endpoint.IsDeleted = false; var insertCount = _dataTypesRepo.Insert(endpoint); if (insertCount == 0) { throw new Exception("endpoint was not created"); } }
public void Put([FromRoute] int id, [FromBody] EndpointEntity endpoint) { _endpointService.Update(endpoint); }
public void Post([FromBody] EndpointEntity endpoint) { _endpointService.Create(endpoint); }