public int Delete(DataTypesEntity entpoint) { using (var db = new SqlConnection(_config)) { const string sql = "UPDATE DataTypes SET IsDeleted = 1 WHERE Id = @Id"; return(db.Execute(sql, entpoint)); } }
public int Insert(DataTypesEntity entpoint) { using (var db = new SqlConnection(_config)) { const string sql = "INSERT INTO DataTypes (Name, Description, Type, UsedForSearch, DefaultValue, EafAccountId, IsDeleted) " + "VALUES(@Name, @Description, @Type, @UsedForSearch, @DefaultValue, @EafAccountId, 0)"; return(db.Execute(sql, entpoint)); } }
public int Update(DataTypesEntity entpoint) { using (var db = new SqlConnection(_config)) { const string sql = "UPDATE DataTypes SET Name = @Name, Description = @Description, Type = @Type, UsedForSearch = @UsedForSearch, DefaultValue = @DefaultValue " + "WHERE Id = @Id"; return(db.Execute(sql, entpoint)); } }
public void Delete(DataTypesEntity dataType) { var updateCount = _dataTypesRepo.Delete(dataType); if (updateCount == 0) { throw new Exception("dataType was not deleted"); } }
public void Update(DataTypesEntity dataType) { dataType.IsDeleted = false; var updateCount = _dataTypesRepo.Update(dataType); if (updateCount == 0) { throw new Exception("dataType was not updated"); } }
public void Create(DataTypesEntity dataType) { dataType.IsDeleted = false; var insertCount = _dataTypesRepo.Insert(dataType); if (insertCount == 0) { throw new Exception("dataType was not created"); } }
public void Put([FromRoute] int id, [FromBody] DataTypesEntity dataType) { _dataTypeService.Update(dataType); }
public void Post([FromBody] DataTypesEntity dataType) { _dataTypeService.Create(dataType); }