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

            if (updateCount == 0)
            {
                throw new Exception("endpoint was not deleted");
            }
        }
Example #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");
            }
        }
Example #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");
            }
        }
Example #7
0
 public void Put([FromRoute] int id, [FromBody] EndpointEntity endpoint)
 {
     _endpointService.Update(endpoint);
 }
Example #8
0
 public void Post([FromBody] EndpointEntity endpoint)
 {
     _endpointService.Create(endpoint);
 }