Beispiel #1
0
 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));
     }
 }
Beispiel #2
0
 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));
     }
 }
Beispiel #3
0
 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));
     }
 }
Beispiel #4
0
        public void Delete(EndpointEntity endpoint)
        {
            var updateCount = _dataTypesRepo.Delete(endpoint);

            if (updateCount == 0)
            {
                throw new Exception("endpoint was not deleted");
            }
        }
Beispiel #5
0
        public void Update(EndpointEntity endpoint)
        {
            endpoint.IsDeleted = false;
            var updateCount = _dataTypesRepo.Update(endpoint);

            if (updateCount == 0)
            {
                throw new Exception("endpoint was not updated");
            }
        }
Beispiel #6
0
        public void Create(EndpointEntity endpoint)
        {
            endpoint.IsDeleted = false;
            var insertCount = _dataTypesRepo.Insert(endpoint);

            if (insertCount == 0)
            {
                throw new Exception("endpoint was not created");
            }
        }
Beispiel #7
0
 public void Put([FromRoute] int id, [FromBody] EndpointEntity endpoint)
 {
     _endpointService.Update(endpoint);
 }
Beispiel #8
0
 public void Post([FromBody] EndpointEntity endpoint)
 {
     _endpointService.Create(endpoint);
 }